DHCP client on removable interface

Alexander Pohoyda <[email protected]>
Newsgroups gmane.os.freebsd.devel.mobile
Message-ID <[email protected]>
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     [email protected]:/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
<[email protected]>
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-mobile
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.