Date: Sun, 3 Aug 2003 20:31:32 +0200 (CEST) From: Alexander Pohoyda <alexander.pohoyda@gmx.net> To: freebsd-mobile@freebsd.org Subject: DHCP client on removable interface Message-ID: <200308031831.h73IVWth008006@oak.pohoyda.family>
next in thread | raw e-mail | index | archive | help
Hi all, I was having problems with dhclient program on my notebook. The symptom: Every time I turned the notebook ON with a PCMCIA NIC inserted, no DHCP configuration was present on the ed0 interface. DHCP worked well anytime I inserted a NIC after the system startup. The configuration: /etc/rc.conf ifconfig_ed0="dhcp" /etc/defaults/rc.conf network_interfaces="auto" The system: FreeBSD oak.pohoyda.family 4.8-STABLE FreeBSD 4.8-STABLE #68: Mon Jul 21 20:31:53 CEST 2003 apog@oak.pohoyda.family:/usr/src/sys/compile/OAK i386 I investigated the issue and found out that the dhclient program is called twice during the system startup when a NIC is inserted. First, it is called from the /etc/pccard_ether, and this time interface is successfully configured. Second time it is called from the /etc/rc.network, and after this call the interface is left disconfigured. If I insert the card after system startup, dhclient is called only once, and everything works as expected. Am I doing something wrong? Has anybody experienced this as well? What's the correct way to fix this? My solution goes like this: ====== --- rc.network.orig Sun Aug 3 20:23:32 2003 +++ rc.network Tue Jun 24 09:46:30 2003 @@ -218,7 +218,10 @@ done if [ ! -z "${dhcp_interfaces}" ]; then - ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + ps -ax | grep dhclient >/dev/null + if [ $? = 1 ]; then + ${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces} + fi fi for ifn in ${network_interfaces}; do ====== It works great for me. -- Alexander Pohoyda <alexander.pohoyda@gmx.net>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308031831.h73IVWth008006>