Simon Poole writes:

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.
diff --git a/examples/udhcp/sample.bound b/examples/udhcp/sample.bound
index 2003526..2a95d8b 100755
--- a/examples/udhcp/sample.bound
+++ b/examples/udhcp/sample.bound
@@ -15,9 +15,10 @@
 	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
 
diff --git a/examples/udhcp/sample.renew b/examples/udhcp/sample.renew
index c953e97..842bafe 100755
--- a/examples/udhcp/sample.renew
+++ b/examples/udhcp/sample.renew
@@ -15,9 +15,10 @@
 	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
 
diff --git a/examples/udhcp/simple.script b/examples/udhcp/simple.script
index a52a7f8..98ebc15 100644
--- a/examples/udhcp/simple.script
+++ b/examples/udhcp/simple.script
@@ -22,8 +22,9 @@
 				:
 			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