Hello,
I'm using shorewall-4.5.16 with centos5. The dhclient stores the lease
information on
the /var/lib/dhclient/dhclient-<DEVICE>.leases file.
The /var/lib/shorewall/firewall script has the function detect_dynamic_gateway
that
detects the gateway based on the leases file. The code in the function is:
detect_dynamic_gateway() { # $1 = interface
local interface
interface=$1
local GATEWAYS
GATEWAYS=
local gateway
gateway=$(run_findgw_exit $1);
if [ -z "$gateway" ]; then
gateway=$( find_peer $($IP addr list $interface ) )
fi
if [ -z "$gateway" -a -f ${VARLIB}/dhcpcd/dhcpcd-${1}.info ]; then
eval $(grep ^GATEWAYS= ${VARLIB}/dhcpcd/dhcpcd-${1}.info 2> /dev/null)
[ -n "$GATEWAYS" ] && GATEWAYS=${GATEWAYS%,*} && gateway=$GATEWAYS
fi
if [ -z "$gateway" -a -f ${VARLIB}/dhcp/dhclient-${0}.lease ]; then
gateway=$(grep 'option routers' ${VARLIB}/dhcp/dhclient-${1}.lease |
tail -n 1 |
while read j1 j2 gateway; do echo $gateway ; return 0; done)
fi
[ -n "$gateway" ] && echo $gateway
}
How do you have the lease file in there? Is it only for some linux distro, say
ubuntu?
In centos is hardcoded to another directory:
root localhost /etc/sysconfig/network-scripts # grep DHCLIENTARGS ifup-eth
DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf
/var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid"
The attached patch correct this issue. Can you please import it?
Thanks,
Nuno Fernandes
--- firewall.orig 2013-10-10 11:35:59.799999544 +0100
+++ firewall 2013-10-10 11:45:38.995999278 +0100
@@ -850,6 +850,10 @@
gateway=$(grep 'option routers' ${VARLIB}/dhcp/dhclient-${1}.lease | tail -n 1 | while read j1 j2 gateway; do echo $gateway ; return 0; done)
fi
+ if [ -z "$gateway" -a -f ${VARLIB}/dhclient/dhclient-${1}.leases ]; then
+ gateway=$(grep 'option routers' ${VARLIB}/dhclient/dhclient-${1}.leases | tail -n 1 | sed -e 's/;//g' | while read j1 j2 gateway; do echo $gateway ; return 0; done)
+ fi
+
[ -n "$gateway" ] && echo $gateway
}
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Shorewall-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-users