WOL packet forwarding

All about firmwares for routers. Support for RouterTech firmwares is here too.
Post Reply
rab
Novice
Novice
Posts: 16
Joined: Sun Apr 12, 2009 12:09 pm

WOL packet forwarding

Post by rab » Fri Aug 14, 2009 8:22 pm

I wasn't really happy with the work-arounds for forwarding WOL magic-packets to the LAN, so I wrote this simple bit of code that will forward them for you (attached).

Here is an appropriate bit of script for starting it via /usr/local/bin/routertech_misc_inits.sh:

Code: Select all

wol_forward=$(cat $saved_env | grep 'wol_forward' | sed "s/wol_forward\t//")
if [ -n "$wol_forward" ]; then
   port=$(echo $wol_forward | sed 's/[^ ]* [^ ]* \([^ ]*\).*/\1/')
   iptables -I INPUT -p udp -s 0/0 -d 0/0 --destination-port $port -j ACCEPT
   /usr/sbin/wol_forward $wol_forward &
   sleep 1
fi
To enable (and configure) do this:

Code: Select all

setenv wol_forward "ppp0 br0 7"
Those params are passed direct to the app, contains extrenal iface, internal iface, and port number. Port number is also parsed by the script above to create an appropriate iptables rule. You can append " debug" to the options list to get some output on what's going on, in case of problems.
Attachments
wol_forward.tar.bz2
broadcasts wake on lan packets arriving at the external interface to your local network
(5.37 KiB) Downloaded 472 times
Post Reply