I've been using SNMP (Simple Network Management Protocol) queries recently, and as I was poking though the various MIB (Management Information Base)s supported by our routers, I noticed that one could get a mapping of IP (Internet Protocol) addresses to MAC (Media Access Control) addresses, and a mapping of MAC addresses to ports. Now that would make a decent tool, I thought, to track down a MAC address to a port on any switch or router.
But when I was simulating this by hand (to get a feeling for how it would work) I ran into a problem with the Riverstone (and it's not like this hasn't happened [1] before [2]). While the Riverstone does support the proper MIBs (SNMPv2-SMI::mib-2.17.4.3.1.1 and SNMPv2-SMI::mib-2.17.4.3.1.2 together will give you the MAC to port mapping) the port it returns is not the physical port the machine is plugged into, but the VLAN (Virtual Local Area Network) the machine is using, which can be any number of ports.
Sigh.
In other SNMP programming news, I've modified the ospfquery program to automatically determine the type of router so it can send the appropriate queries to obtain the route table (the Riverstone uses different MIBs than normal). I've also cleaned up the code quite a bit. It's always nice to not only remove code, but to increase functionality at the same time. And I've made it easier to extend the code base.