#
# Shorewall version 4 - Findgw File
#
# /etc/shorewall/findgw -- customized for Foobar Linux
#
#    The code in this file is executed when Shorewall is trying to detect the
#    gateway through an interface in /etc/shorewall/providers that has GATEWAY
#    specified as 'detect'.
#
#    The function should echo the IP address of the gateway if it knows what
#    it is; the name of the interface is in $1.
#
# See http://shorewall.net/shorewall_extension_scripts.htm for additional
# information.
#
###############################################################################
if [ -f /var/lib/dhclient/dhclient-${1}.leases ]; then
    grep 'option routers' /var/lib/dhclient/dhclient-${1}.leases | tail -n 1 | while read j1 j2 gateway; do echo $gateway | sed 's/;//'; return 0; done
fi
#LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE
