[pkg-dhcp-devel] Bug#629863: isc-dhcp-client: error dhcping means no routes are installed
Sanjoy Mahajan
sanjoy at olin.edu
Wed Jun 8 23:33:29 UTC 2011
Package: isc-dhcp-client
Version: 4.1.1-P1-17
Severity: grave
File: /sbin/dhclient-script
Today I noticed that ifup using dhcp kept failing, and I had to add the
routes manually. The problem was in running dhclient, which would give
an error when executing the following shell command from
/sbin/dhclient-script:
ip -4 addr add 192.168.101.18/255.255.255.0 broadcast 192.168.101.255 dev wlan0 label wlan0
The error was:
Error: an inet prefix is expected rather than "192.168.101.18/255.255.255.0".
In the address, the information after the slash needs to be the number
of "1" bits in the netmask, rather than the netmask itself. The
following hacky diff fixes it for me, but I doubt it's the best fix:
--- /sbin/dhclient-script 2011-05-19 02:13:42.000000000 -0400
+++ /sbin/dhclient-script 2011-06-08 19:17:00.000000000 -0400
@@ -140,6 +140,7 @@
fi
if [ -n "$new_subnet_mask" ]; then
new_mask="/$new_subnet_mask"
+ new_mask_bits=`echo "$new_subnet_mask" | awk -F. '{print ($1+$2+$3+$4)/255*8;}'`
fi
if [ -n "$alias_subnet_mask" ]; then
alias_mask="/$alias_subnet_mask"
@@ -209,7 +210,7 @@
[ "$old_ip_address" != "$new_ip_address" ] ||
[ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
# new IP has been leased or leased IP changed => set it
- ip -4 addr add ${new_ip_address}${new_mask} ${new_broadcast_arg} \
+ ip -4 addr add ${new_ip_address}/${new_mask_bits} ${new_broadcast_arg} \
dev ${interface} label ${interface}
if [ -n "$new_interface_mtu" ]; then
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.38-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages isc-dhcp-client depends on:
ii debianutils 4 Miscellaneous utilities specific t
ii iproute 20110315-1 networking and traffic control too
ii isc-dhcp-common 4.1.1-P1-17 common files used by all the isc-d
ii libc6 2.13-4 Embedded GNU C Library: Shared lib
isc-dhcp-client recommends no packages.
Versions of packages isc-dhcp-client suggests:
pn avahi-autoipd <none> (no description available)
pn resolvconf <none> (no description available)
-- Configuration Files:
/etc/dhcp/dhclient.conf changed:
supersede domain-name "mit.edu";
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu;
-- debconf-show failed
--
-Sanjoy
`Until lions have their historians, tales of the hunt shall always
glorify the hunters.' --African Proverb
More information about the pkg-dhcp-devel
mailing list