Simon Poole writes:
authorEric Andersen <andersen@codepoet.org>
Wed, 13 Oct 2004 07:18:05 +0000 (07:18 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 13 Oct 2004 07:18:05 +0000 (07:18 -0000)
Erik,

Attached is a patch for the udhcpc sample scripts, to correct the order in
which routers are applied if the DHCP server provides more than one (as per
section 3.5 of RFC2132).

Apologies for not being on the mailing list and thanks for your continued
efforts.

Simon.

examples/udhcp/sample.bound
examples/udhcp/sample.renew
examples/udhcp/simple.script

index 200352672d1e4c277d855cee56abce84f4c1b6bb..2a95d8b7d5994ad8ab5ea94f6c395cab1872f1cd 100755 (executable)
@@ -15,9 +15,10 @@ then
        do :
        done
 
+       metric=0
        for i in $router
        do
-               /sbin/route add default gw $i dev $interface
+               /sbin/route add default gw $i dev $interface metric $((metric++))
        done
 fi
 
index c953e9758845860783acc1cbe0e290797829d948..842bafe916dceb2469b630b4abb6717019a7630a 100755 (executable)
@@ -15,9 +15,10 @@ then
        do :
        done
 
+       metric=0
        for i in $router
        do
-               /sbin/route add default gw $i dev $interface
+               /sbin/route add default gw $i dev $interface metric $((metric++))
        done
 fi
 
index a52a7f8122c8c7e2c12c03a0d6f19791f908113b..98ebc159f0e5c5a477bab2f2a4827882c2866791 100644 (file)
@@ -22,8 +22,9 @@ case "$1" in
                                :
                        done
 
+                       metric=0
                        for i in $router ; do
-                               route add default gw $i dev $interface
+                               route add default gw $i dev $interface metric $((metric++))
                        done
                fi