tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

dhclient-script: trying harder to set correct default route



The following behaviour has been annoying me for a long time and I had
the appended patch in my local trees for a couple of years.

When dhclient runs dhclient-script after binding to set the new IP address
and default route (among other things), it fails to set the new default route
if there already exists a default route in the system.  I get that situation
regularly when restarting dhclient.

Does anyone object to the following patch?  I asked Ted Lemon about it
and he said it is OK with him.

Index: clientscript/dhclient-script
===================================================================
RCS file: /cvsroot/src/usr.sbin/dhcp/clientscript/dhclient-script,v
retrieving revision 1.13
diff -u -r1.13 dhclient-script
--- clientscript/dhclient-script        21 Nov 2009 07:53:59 -0000      1.13
+++ clientscript/dhclient-script        10 Feb 2010 19:36:53 -0000
@@ -64,7 +64,8 @@
 
 add_new_routes() {
        for router in $new_routers; do
-               route add default $router
+               route add default $router ||
+                       route change default $router
        done >/dev/null 2>&1
 
        set -- $new_static_routes

--chris


Home | Main Index | Thread Index | Old Index