[prev in list] [next in list] [prev in thread] [next in thread]
List: dhcp-client
Subject: Re: laptop changing ip when expire bug on linux found
From: Hermann Lauer <hermann.lauer () iwr ! uni-heidelberg ! de>
Date: 2001-05-25 15:55:25
[Download RAW message or body]
*** From dhcp-client -- To unsubscribe, see the end of this message. ***
Hello,
as I promised you will find attached the patch for the
linux client script to solve the dhcp protocol
violation. Included is also a test in the
timeout branch to use broadcast ping to discover
other computers if you have no router in the
permanent lease (as I at home).
Some comments has also been trimmed.
Please test & include if it is okay - or shout, when not.
Thanks
Greetings
Hermann
On Fri, May 18, 2001 at 05:45:12PM +0200, Hermann Lauer wrote:
> Hello,
>
> I think I now have found the reason for
> then changing ip while expire laptop problem: The
> expire dhclientscript only disables the interface, which
> will save the ip and if you configure the interface up
> in the preinint state using only "ifconfig up" this
> ip is reactivatet and the client violates the dhcp protocol.
> The server notices the ip is in use and gives out another lease.
>
> Fix is easy: configure the interface to 0.0.0.0. Will
> send in a patch to dhclient script in a couple of days,
> which will also fix an strange bahavior if you have no
> routers defined in a permanent lease.
>
> Of course others will have to check the behavior of
> ifconfig on other linux kernels ( I'm using 2.2.x here).
>
> The first bug happens only on sleeping laptops - other
> computers will renew the lease early enough to never
> fall into this.
>
> Question: tried to play a little with omshell (because
> of the prolonged select while sleeping problem), but
> dhclient seems not to start an omapi listener - at least
> not on the default port "7911".
>
> Thanks for any docu (which seems to be underway) and
> other insights into this.
>
> Greetings
> Hermann
--
Bildverarbeitungsgruppe des Interdiziplinaeren Zentrums fuer
wissenschaftliches Rechnen, Universitaet Heidelberg
INF 368; 69120 Heidelberg; Tel: (06221)54-6314, -8826 Fax: -6405
Email: Hermann.Lauer@iwr.uni-heidelberg.de
-- Attached file included as plaintext by Listar --
--- dhcp-3.0rc7/client/scripts/linux.oscr Tue May 22 10:32:21 2001
+++ dhcp-3.0rc7/client/scripts/linux Tue May 22 10:44:06 2001
@@ -3,6 +3,9 @@
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
# No guarantees about this. I'm a novice at the details of Linux
# networking.
+# by Hermann Lauer, May 2001:
+# fix for EXPIRE/PREINIT bug in at least Linux 2.2.x (interface comes
+# up with remembered old ip, which violates the dhcp specs)
# Notes:
@@ -19,8 +22,9 @@
# address if it is not supplied. This might be much more easily done
# by the dhclient C code, and passed on.
-# 4. TIMEOUT not tested. ping has a flag I don't know, and I'm suspicious
-# of the $1 in its args.
+# 4. TIMEOUT should work now (even with no routers defined, will broadcast
+# ping then to detect other computers)
+
function make_resolv_conf() {
echo search $new_domain_name >/etc/resolv.conf
@@ -88,7 +92,8 @@
# Add route to make broadcast work. Do not omit netmask.
route add default dev $interface netmask 0.0.0.0
else
- ifconfig $interface up
+# ifconfig $interface up #nope, this reinstalls the old ip in 2.2.x
+ ifconfig $interface inet 0.0.0.0 up
fi
# We need to give the kernel some time to get the interface up.
@@ -169,8 +174,9 @@
fi
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg
+#are there any routers defined ?
+ if [ -n "$new_routers" ]; then
set $new_routers
- ############## what is -w in ping?
if ping -q -c 1 $1; then
if [ x$new_ip_address != x$alias_ip_address ] && \
[ x$alias_ip_address != x ]; then
@@ -187,8 +193,16 @@
make_resolv_conf
exit_with_hooks 0
fi
- ifconfig $interface inet down
- exit_with_hooks 1
+ else
+#no, try broadcast ping and see if anybody besides us is out there
+ if ping -c 2 -b $new_broadcast_address | fgrep "bytes from" | fgrep -v -q $new_ip_address
+ then
+ make_resolv_conf
+ exit_with_hooks 0
+ fi
+ fi
+ ifconfig $interface inet down
+ exit_with_hooks 1
fi
exit_with_hooks 0
-----------------------------------------------------------------------
To unsubscribe from this list, visit http://www.isc.org/dhcp-lists.html
or send mail to dhcp-client-request@isc.org with the subject line of
'unsubscribe'.
-----------------------------------------------------------------------
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic