I'm looking to use Net-SNMP snmpd in our automated test suite. The way our tests are architected, we will need to have a number of snmp agents which we can start and stop at will, and have a number of agents running on the same box at the same time.
These requirements make it impractical to have snmpd listening on a fixed port. The solution is to have snmpd bind to port 0 (asking the kernel to pick any free port), discover what port was chosen with getsockname() and then write this into a specified file. Tests which need to talk to this snmpd instance can read that file to find out where it is listening. We've done this before with other kinds servers; the general scheme works well. My question is about the changes that have to be made to snmpd (I've got 5.4.1). From what I can tell, the only real changes that need to happen are in snmpUDPDomain.c:netsnmp_udp_transport(). If addr- >sin_port == 0, after doing the bind() on line 650, I'd need to do the getsockname(), write the port back into addr->sin_port, and write a string representation of addr out into the designated file. I don't see any reason why that shouldn't work, but I'm not familiar with the architecture of the rest of the system. Are there any hidden gotchas or unanticipated side effects of this that I should be aware of? I also need to track down all other places where snmpd reads or writes files at fixed locations in the file system; all of these will need to be made to work relative to some designated temp directory. Hopefully, that won't end up being too many places :-) ------------------- Roy Smith <[EMAIL PROTECTED]> Software Guy, EMC Common Management Group 44 South Broadway, 7th floor White Plains, NY 10601 +1 914 580 3427 AIM: roysmith649 ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
