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

Bug#774156: busybox-udeb: udhcpc default.script fails if $router is not set



Package: busybox-udeb
Version: 1:1.20.0-7
Severity: important

Dear Maintainer,

The script /etc/udhcpc/default.script executed by udhcpc within debian-installer
fails when DHCP servers give a lease without option 3 (router) with the
following error:

~ # udhcpc
udhcpc (v1.20.2) started
+ ip link set eth0 up
+ ip -4 addr flush dev eth0
+ exit 0
Sending discover...
Sending select for 10.11.0.11...
Lease of 10.11.0.11 obtained, lease time 172800
+ do_hostname
+ cat /proc/sys/kernel/hostname
+ local current=cn1
+ [ -z cn1 ]
+ [ cn1 = (none) ]
+ ip -4 addr add 10.11.0.11/255.255.255.0 dev eth0
+ [ -n  ]
+ ip -4 route add default via
ip: RTNETLINK answers: No such device

Even if $router variable is not set, the script enters the for loop that set the
routes. It makes the ip command fail because of missing argument.

This is a bit annoying since this prevent the other dhcp options (dns servers,
domain name and so on) from being processing correctly and then makes netcfg ask
questions.

The patch attached fixes this by checking if $router is not empty before the for
statement. This fixes the bug for me.

-- System Information:
Debian Release: 7.7
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/debian/tree/busybox-udeb/etc/udhcpc/default.script b/debian/tree/busybox-udeb/etc/udhcpc/default.script
index a47bdae..bba0d6b 100755
--- a/debian/tree/busybox-udeb/etc/udhcpc/default.script
+++ b/debian/tree/busybox-udeb/etc/udhcpc/default.script
@@ -66,12 +66,14 @@ case "$1" in
 			ip link set "$interface" mtu "$mtu"
 		fi
 
-		# special case for /32 subnets, use onlink when adding routes
-		[ ".$subnet" = .255.255.255.255 ] \
-			 && onlink=onlink || onlink=
-		for r in "$router"; do
-			ip -4 route add default via "$r" $onlink
-		done
+		if [ -n "$router" ]; then
+			# special case for /32 subnets, use onlink when adding routes
+			[ ".$subnet" = .255.255.255.255 ] \
+				 && onlink=onlink || onlink=
+			for r in "$router"; do
+				ip -4 route add default via "$r" $onlink
+			done
+		fi
 
 		do_resolv_conf
 

Reply to: