[prev in list] [next in list] [prev in thread] [next in thread]
List: dhcp-client
Subject: FreeBSD (and perhaps other) dhclient-script bugs
From: "Michael C. Adler" <madler () vssad ! hlo ! dec ! com>
Date: 1999-12-07 4:49:01
[Download RAW message or body]
*** From dhcp-client -- To unsubscribe, see the end of this message. ***
At least on FreeBSD I've encountered some dhclient-script bugs. I'm
using V2.0 but the script for the current version is basically the same
and still has bugs.
The basic problem is that there are a number of cases in which dhclient
may invoke dhclient-script with $old_ip_address empty in spite of the
fact that the script has already been invoked and the interface is
actually configured. I can get both BOUND and REBOOT to be called in
different circumstances. I believe BOUND is called when the DHCP server
changes and offers a different IP address. I believe REBOOT is called
if dhclient is killed and restarted. In neither case was
$old_ip_address set for me.
In any event, it is relatively simple to change dhclient-script to
handle this case as long as no aliases have been declared and the
routing table only has a default root. For those cases, I now delete
the default root and clear the arp table whenever ifconfig is invoked to
set up an IP address.
There is also a race condition in the existing dhclient-script. For
BOUND, REBOUND, etc., the arp table is cleared when old_ip_address
exists BEFORE ifconfig is invoked to rebind the interface. There is a
short window between the two in which the arp table could be repopulated
with soon to be invalid entries.
I've also found the route add $new_ip_address 127.1 lines to cause
nothing but trouble for me on FreeBSD 3.3 and commented them out. Are
they necessary?
Am I misunderstanding something? I've attached my patch file for V2.0.
-Michael
-- Attached file included as plaintext by Listar --
-- File: freebsd.patch
*** freebsd.orig Mon Dec 6 23:29:44 1999
--- freebsd Mon Dec 6 23:29:41 1999
***************
*** 61,68 ****
--- 61,72 ----
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi
+ if [ `netstat -nr | grep -c default` -gt 0 ]; then
+ route delete default
+ fi
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
+ arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh
exit_with_hooks 0
fi
***************
*** 90,102 ****
shift; shift
done
fi
- arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh
fi
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
ifconfig $interface inet $new_ip_address $new_netmask_arg \
$new_broadcast_arg $medium
! route add $new_ip_address 127.1 >/dev/null 2>&1
for router in $new_routers; do
route add default $router >/dev/null 2>&1
done
--- 94,108 ----
shift; shift
done
fi
fi
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ if [ `netstat -nr | grep -c default` -gt 0 ]; then
+ route delete default
+ fi
ifconfig $interface inet $new_ip_address $new_netmask_arg \
$new_broadcast_arg $medium
! # route add $new_ip_address 127.1 >/dev/null 2>&1
for router in $new_routers; do
route add default $router >/dev/null 2>&1
done
***************
*** 107,112 ****
--- 113,119 ----
shift; shift
done
fi
+ arp -n -a | sed -n -e 's/^.*(\(.*\)) at .*$/arp -n -d \1/p' |sh
fi
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
then
***************
*** 164,170 ****
ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
route add $alias_ip_address 127.0.0.1
fi
! route add $new_ip_address 127.1 >/dev/null 2>&1
for router in $new_routers; do
route add default $router >/dev/null 2>&1
done
--- 171,177 ----
ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
route add $alias_ip_address 127.0.0.1
fi
! # route add $new_ip_address 127.1 >/dev/null 2>&1
for router in $new_routers; do
route add default $router >/dev/null 2>&1
done
-----------------------------------------------------------------------
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