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

#774156#5
Date:
2014-12-29 16:55:52 UTC
From:
To:
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.