diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-10-16 17:34:42 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-10-16 17:34:42 +0000 |
commit | e1c8cdf529bba36dec64f16206e364ffa2b519d8 (patch) | |
tree | 6bcc6db8a954996aa88ebdfe8a45b9134c3fc79f /sbin | |
parent | eba1ebc151a00fb008e39de009bb6ba366dc52f4 (diff) | |
download | pfsense-e1c8cdf529bba36dec64f16206e364ffa2b519d8.zip pfsense-e1c8cdf529bba36dec64f16206e364ffa2b519d8.tar.gz |
MFC 6871
If WAN is pppoe, hold down boot until connection is established This will help anyone with PPPOE on WAN and DHCP on OPTx not get incorrect gateways assigned.
Diffstat (limited to 'sbin')
-rwxr-xr-x | sbin/dhclient-script | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/sbin/dhclient-script b/sbin/dhclient-script index 89a00a0..e4f7f47 100755 --- a/sbin/dhclient-script +++ b/sbin/dhclient-script @@ -94,12 +94,16 @@ add_new_alias() { delete_old_routes() { $ROUTE delete "$old_ip_address" $LOCALHOST >/dev/null 2>&1 - for router in $old_routers; do - if [ $if_defaultroute = x -o $if_defaultroute = $interface ]; then - $ROUTE delete default $route >/dev/null 2>&1 - /bin/rm -f /tmp/${interface}_router - fi - done + # Only allow the default route to be overridden if it's on our own interface + DEFAULTROUTE_IFACE=`route get default | grep interface | awk '{print $2};'` + if [ -z "${DEFAULTROUTE_IFACE}" -o "{$interface}" = "${DEFAULTROUTE_IFACE}" ]; then + for router in $old_routers; do + if [ $if_defaultroute = x -o $if_defaultroute = $interface ]; then + $ROUTE delete default $route >/dev/null 2>&1 + /bin/rm -f /tmp/${interface}_router + fi + done + fi if [ -n "$old_static_routes" ]; then set $old_static_routes @@ -115,22 +119,27 @@ delete_old_routes() { add_new_routes() { $ROUTE add $new_ip_address $LOCALHOST >/dev/null 2>&1 - for router in $new_routers; do - if [ "$new_ip_address" = "$router" ]; then - $ROUTE add default -iface $router - #>/dev/null 2>&1 - echo $ROUTE add default -iface $router | $LOGGER - echo $new_routers > /tmp/${interface}_router - else - $ROUTE add default $router - echo $ROUTE add default $router | $LOGGER - #>/dev/null 2>&1 - echo $new_routers > /tmp/${interface}_router - fi - # 2nd and subsequent default routers error out, so explicitly - # stop processing the list after the first one. - break - done + + # Only allow the default route to be overridden if it's on our own interface + DEFAULTROUTE_IFACE=`route get default | grep interface | awk '{print $2};'` + if [ -z "${DEFAULTROUTE_IFACE}" -o "{$interface}" = "${DEFAULTROUTE_IFACE}" ]; then + for router in $new_routers; do + if [ "$new_ip_address" = "$router" ]; then + $ROUTE add default -iface $router + #>/dev/null 2>&1 + echo $ROUTE add default -iface $router | $LOGGER + echo $new_routers > /tmp/${interface}_router + else + $ROUTE add default $router + echo $ROUTE add default $router | $LOGGER + #>/dev/null 2>&1 + echo $new_routers > /tmp/${interface}_router + fi + # 2nd and subsequent default routers error out, so explicitly + # stop processing the list after the first one. + break + done + fi if [ -n "$new_static_routes" ]; then $LOGGER "New Static Routes ($interface): $new_static_routes" |