Contributed by pitrh on from the walkabout puffy dept.
This is a fan letter for my fellow developer Ken Westerback (krw@). Ken is currently partway through the thankless job of modernizing dhclient - it's already much better, and I think it will be really good for 5.3 an will probably take on new life afterwards with more improvements.
If you're like me, and run around with an OpenBSD laptop, dhclient has been the bane of my existence.
My mac or windows machine just attaches to the networks I want, OpenBSD does not. This displeased me greatly. Every time I moved off of one wavelan, or plugged in a wired network, it would usually get something wrong, most always resolv.conf - it would use the wrong resolv.conf for where my packets were going.. grr. The net result was usually pkill dhclient, restart.. manually set nwid, etc. etc. pain - swearing - wishing someone would fix it.
After some discussion in New Zealand, krw managed to fix it up - basically the dhclient in current only puts in resolv.conf if it is dealing with the current highest priority default route - with this change it's awesome, resolv.conf changes seamlessly as my machine switches from wired to wireless interfaces, I never need to restart dhclient, just leave it running.. sweet.
However now there was one little thing missing, so, this afternoon, (needing a distraction from sticking my fingers in uvm) I managed to cook up something I'll share with you all. It's a teeny little shell script that I run now and it seems to work pretty darn good. It simply watches for a wireless interface to not be "active" and when it sees that, it tries in order, a list of nwid's you keep in a file (potentially with keys..) I also made it run a little activate script after associating and waiting for dhclient to do it's thing so that I could manage to send recorded "click this to agree" http POST responses to automate annoying captive proxy requests.
I'll share at http://foad2.obtuse.com/beck/wifinwid
Read the comments to figure out how to use it..
Anyway, I now roam seamlessly between my preferred wireless nets and my debug syslogs just shows:
Feb 7 19:49:06 rocinante wifinwid: interface iwn0 appears inactive
Feb 7 19:49:06 rocinante wifinwid: trying ifconfig iwn0 nwid bob
Feb 7 19:49:10 rocinante dhclient: DHCPREQUEST on iwn0 to 255.255.255.255 port 67
Feb 7 19:49:11 rocinante dhclient: DHCPREQUEST on iwn0 to 255.255.255.255 port 67
Feb 7 19:49:11 rocinante dhclient: DHCPACK from 192.168.41.3 (00:0d:b9:1a:ae:3d)
Feb 7 19:49:11 rocinante dhclient: bound to 192.168.41.129 -- renewal in 21600 seconds.
Feb 7 19:49:11 rocinante dhclient: Unexpected DHCPACK from 192.168.41.3 (00:0d:b9:1a:ae:3d). State #4
Feb 7 19:49:12 rocinante wifinwid: attached to network bob on interface iwn0
Thanks muchly for the dhclient changes that made this practical Ken!
Editor's note: An exclusive Undeadly.org interview with krw@ is in the works, stay tuned for further updates!
Yeah, I looked at daniels wiconfig..
... and it wasn't what I wanted. - not to mention that my laptops hav iwn wireless controllers that scan never works on. - hooray for proprietary firmware! I did *not* want to do stuff based on signal strength, I have a user-preferred ordering that I want, just like what I get if I'm using that on osux, or windows and crud.
I also didn't want to deal with running stuff from apmd, because I wanted to just leave dhcp running and let it deal with it, and have it notice when I wander out of range without a suspend. So I just monitors the interface in the background and notices when it isn't "active". then it starts trying. Works better for me. All I do (with -current dhclient) is i have a hostname.iwn0 looks like:
dhcpand I basically never touch it, just works, and with my little activate scripts spitting the "yes I agree" post response for two of those networks which have captive proxy bullshit in front of them, I never get annoyed by the silly "click this to agree" or "log in to this completely insecure page with the password you can't change" crap anymore.. it just gets blatted at it when the network gets used.. - and my ssh's reconnect to my tmux sessions and life is good.
!/usr/local/bin/wifinwid iwn0 &
(Comments are closed)