in reply to Tao Perl Ching - The Scripture of the Way of Perl
I work on a small device that connects to cash registers & vending machines, and allows payment to be made via RFID keychain tags. The devices communicate to our system over the Internet. They first go through a router (called a 'gate') that serves basically as a NAT bridge between their proprietary wireless radios and a ethernet/modem uplink.
As time passed, things changed, and it was decided that we needed to have the devices automatically detect this event, and reboot themselves accordingly. This was accomplished by periodically sending PPP echo-request packets, and rebooting if no reply came back within a certain time threshold.
A few months later, we discovered that some of the devices would sometimes come up and be unable to communicate -- even though they could ping. I spent many days poring over hundreds of megabytes of debugging output logs, trying to determine just what was going wrong -- nothing could connect, yet the PPP echoes were being replied to, so the gate link was valid (or so I thought).
It turned out that the problem stemmed from the original designers' decision to force PPP to fit their system -- as part of the initial PPP negotiation, the devices could get confused and start sending packets to other devices (instead of the gate)! The catch is, this could only happen if one device was rebooted several minutes before another. Which did not happen until the 'automatic reboot' policy was instated.
I'd known all along that PPP was totally wrong for the design, but it was not until this day that I understood *how* wrong it was. I couldn't change PPP more to fix the problem. What was I to do?
I switched to a protocol designed for a system exactly like ours: a shared broadcast medium, where everybody sees everyone else's packets -- the Ethernet protocol.
I threw DHCP clients onto the devices, a DHCP server onto the gate, and used the Ethernet portion of the IP stack to handle everything else (incl. ARP).
And in three days, I solved a problem that had plagued us for over six months.
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc
|
|---|