wok-stable rev 12452
knock: set default interface
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Aug 14 10:05:29 2015 +0200 (2015-08-14) |
parents | b1d018746484 |
children | e461ba20971c |
files | knock/stuff/etc/init.d/knock |
line diff
1.1 --- a/knock/stuff/etc/init.d/knock Tue Jun 16 10:13:52 2015 +0200 1.2 +++ b/knock/stuff/etc/init.d/knock Fri Aug 14 10:05:29 2015 +0200 1.3 @@ -13,7 +13,8 @@ 1.4 DAEMON=/usr/sbin/knockd 1.5 OPTIONS=$KNOCK_OPTIONS 1.6 PIDFILE=/var/run/knockd.pid 1.7 -[ -n "$OPTIONS" ] || OPTIONS="-d" 1.8 +IFACE="$(route -n | awk '{ if ($1 == "0.0.0.0" && $3 == $1) print $8}')" 1.9 +[ -n "$OPTIONS" ] || OPTIONS="-d -i ${IFACE:-eth0}" 1.10 1.11 case "$1" in 1.12 start)