Subject: Re: How to detect net cable plug-in
To: Jason Thorpe <thorpej@wasabisystems.com>
From: Brian Grayson (home) <bgrayson@austin.rr.com>
List: tech-net
Date: 10/14/2003 10:10:44
On Mon, Oct 13, 2003 at 11:39:42PM -0700, Jason Thorpe wrote:
> 
> This is actually the real problem -- dhclient should not be causing the 
> interface to reset in this manner.

  At least for my machine, this is caused by /sbin/dhclient-script doing an
ifconfig ex0 inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up
in the PREINIT handler.  (My laptop is not -current, but it appears
dhclient-script is still at v1.5 in -current.)

  If I do that by hand, ifconfig says the carrier goes away, and then
comes back.

  If I comment out the ifconfig in PREINIT in /sbin/dhclient-script,
my machine seems to still do the right thing.  In fact, my changes to
ifwatchd make it so that I can unplug the cable, plug it back in, and
it reruns dhclient for me precisely once (as desired), and everything
Just Works!

  I'm no networking guru.  Can anyone tell me if that ifconfig to
0.0.0.0 is really necessary?  Is it only necessary if the iface is not
already up?  I can ifconfig to 1.1.1.1, unplug the cable, plug it back
in, and dhclient changes it to 192.168.0.18 like it should....

  Brian