project: merge Internet-connected, non-Internet connected software
David Young <[email protected]>
| Newsgroups | gmane.network.wireless.cu-wireless |
|---|---|
| Message-ID | <[email protected]> |
I have some programming I would like to enlist a volunteer to do. If you've looked recently at our downloads page, <http://www.cuwireless.net/downloads.html>, you know that we have two software distributions. One is for Internet-connected nodes, and the other is for nodes without an Internet connection. This is an undesirable complication from the standpoint of usability and software maintenance. I want to have one software distribution that can do both: it seeks an available Internet connection with DHCP, and if it does not find one, it assigns IP numbers with on the subscriber's net using DHCP. The nodes used to do this, badly: a wireless node tried *once* to get a DHCP lease. If that didn't work, it turned into a DHCP server. The IMC node worked that way. It did the right thing about 90% of the time. The other 10% of the time, after a power failure or something, the IMC node would boot up quicker than the DHCP server at IMC, it would try (and fail) to get a lease, and then turn into a DHCP server. Disaster! The node did not advertise an Internet connection, and the two DHCP servers raced with each other to assign IP numbers to the computers at IMC. The old IMC solution was not too far from being correct. It just needs to try more than once for a DHCP lease. There should be a shell script that runs at boot and "daemonizes" itself. After it turns into a daemon, it tries to get a DHCP lease with "dhclient -1." Failing that, it starts the DHCP server, dhcpd, sleeps for three minutes, shuts down dhcpd, dhclient -1's again, starts dhcpd and sleeps for six minutes if it does not get a lease, and so on, until it sleeps for 96 minutes at a time before trying again to get a DHCP lease. In this way, if no DHCP server is reachable when a node boots, it will still detect a server that becomes available later. If dhclient -1 does get a lease, then the script should sleep. There is a script called something like /etc/dhclient-exit-hooks that dhclient calls when events occur (lease received, lease renewed, lease denied, lease expired). If a lease expires and renewal fails, then your -hooks script should wake the script that controls dhclient/dhcpd by, say, sending it a signal. The script should start its "try dhclient, run dhcpd" cycle again. That's a pretty sophisticated script I have described. I known from experience that it needs to be at least that sophisticated. I don't think it will take more than about a week to program and test. Dave -- David Young OJC Technologies [email protected] Urbana, IL * (217) 278-3933 _______________________________________________ CU-Wireless mailing list [email protected] http://lists.cu.groogroo.com/cgi-bin/listinfo/cu-wireless Project Page: http://cuwireless.ucimc.org