[PATCH] dhclient active interface detection patch
Martin Blapp
mb at imp.ch
Wed May 21 05:23:09 PDT 2003
Hi,
>
> Excellent work. However - we may wish to think about modifying it for
> use wiht 802.11 interfaces. Yesterday I got 4.7-RELEASE working on a
> friend's machine which is now acting as wireless backhaul from a building
> in Bow, East London with an antenna pointed at Hackney; from reboot,
> the machine associates with the AP in Hackney and invokes dhclient
> to get an IP from the AP once associated.
>
> But in order to get things to happen in the right order, I had to create
> a script /etc/start_if.wi0, and write a little program called 'waitforap'.
>
> I've attached it. It's not perfect, but it does the job; rather than
> attempting to perform a DHCPREQUEST broadcast before the interface is
> ready, it waits until wi0's status is 'associated'.
Hi,
Ehm. You should just use my dhclient patch and not need any furter scripts
and patches. I do just the same as you.
All you have to do is :
dhclient -nw wi0
Can you confirm that my patch works here too ?
+ if (ioctl(sock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
+ /*
+ * Interface doesn't support SIOCGIFMEDIA, presume okay
+ */
+ close(sock);
+ return (1);
+ }
+ close(sock);
+
+ if (ifmr.ifm_count == 0) {
+ /*
+ * this is unexpected (to me), but we'll just assume
+ * that this means interface does not support SIOCGIFMEDIA
+ */
+ return (1);
+ }
+
+ if (ifmr.ifm_status & IFM_AVALID) {
+ if (ifmr.ifm_status & IFM_ACTIVE)
+ return (1);
+ } else
+ return (0);
+
+ return (0);
Martin
More information about the freebsd-hackers
mailing list