Detect dhclient dynamic gateway

Signed-off-by: Tom Eastep <teastep@shorewall.net>

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9734 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-03-24 20:58:04 +00:00
parent f28494b802
commit 9328f0fc4c
3 changed files with 10 additions and 0 deletions

View File

@ -820,6 +820,10 @@ detect_dynamic_gateway() { # $1 = interface
[ -n "$GATEWAYS" ] && GATEWAYS=${GATEWAYS%,*} && gateway=$GATEWAYS
fi
if [ -z "$gateway" -a -f /var/lib/dhcp/dhclient-${1}.lease ]; then
gateway=$(grep 'option routers' /var/lib/dhcp/dhclient-${1}.lease | tail -n 1 | while read j1 j2 gateway; do echo $gateway; return 0; done)
fi
[ -n "$gateway" ] && echo $gateway
}

View File

@ -6,6 +6,8 @@ Changes in Shorewall 4.3.8
3) Fix swping
4) Detect gateway via dhclient leases file.
Changes in Shorewall 4.3.7
1) Fix forward treatment of interface options.

View File

@ -61,6 +61,10 @@ None.
error message is generated and the state of the firewall is not
changed.
2) Shorewall will now attempt to detect a dynamic gateway by reading
the dhclient lease file for the interface
(/var/run/dhcp/dhclient-<if>.lease).
----------------------------------------------------------------------------
N E W F E A T U R E S IN 4 . 3
----------------------------------------------------------------------------