# HG changeset patch # User Pascal Bellard # Date 1439539529 -7200 # Node ID 64614005535d2e55957234c9946dbcfb253cd1b7 # Parent b1d018746484302dfd5b07eeb8576164965c64e2 knock: set default interface diff -r b1d018746484 -r 64614005535d knock/stuff/etc/init.d/knock --- a/knock/stuff/etc/init.d/knock Tue Jun 16 10:13:52 2015 +0200 +++ b/knock/stuff/etc/init.d/knock Fri Aug 14 10:05:29 2015 +0200 @@ -13,7 +13,8 @@ DAEMON=/usr/sbin/knockd OPTIONS=$KNOCK_OPTIONS PIDFILE=/var/run/knockd.pid -[ -n "$OPTIONS" ] || OPTIONS="-d" +IFACE="$(route -n | awk '{ if ($1 == "0.0.0.0" && $3 == $1) print $8}')" +[ -n "$OPTIONS" ] || OPTIONS="-d -i ${IFACE:-eth0}" case "$1" in start)