Created attachment 678653 [details] Test python file for purposes of tcpdump to verify invalid IP address Description of problem: I'm trying to simply get a Cisco device to dump its config to a tftp server. This entails a set of 7 snmpset commands, which work fine via the command line using snmpset (attached snmp_test.sh). The problem I'm having is with the python implementation at the step of setting the IP address of the tftp server, specifically that the IP address is gaining extra zeros on the end making it an invalid IP address. For example, the IP address 192.168.0.1 becomes: 192.168.0.1.0.0.0.0 I can see this in a tcpdump capture: SetRequest(43) .1.3.6.1.4.1.9.9.96.1.1.1.1.5.666=[inetaddr len!=4]192.168.0.1.0.0.0.0 And in wireshark in SNMP payload under variable-bindings: snmp.value.addr == c0:a8:00:01:00:00:00:00 A tcpdump of the snmpsets running via snmpset on command line shows that the IP address is as expected: snmp.value.addr == c0:a8:00:01 It would appear that the issues is caused by whatever python is doing to the IPADDR type, effectively rendering IPADDR type unusable. Version-Release number of selected component (if applicable): net-snmp-agent-libs-5.7.2-4.fc18.x86_64 net-snmp-5.7.2-4.fc18.x86_64 net-snmp-python-5.7.2-4.fc18.x86_64 net-snmp-utils-5.7.2-4.fc18.x86_64 net-snmp-libs-5.7.2-4.fc18.x86_64 python-libs-2.7.3-13.fc18.x86_64 python-2.7.3-13.fc18.x86_64 How reproducible: Every time I try it. Steps to Reproduce: 1. run a python script (attached snmp_test.py) which uses type IPADDR (doesn't need to work, it's the outgoing packets that are broken) 2. capture the traffic and note the IP is wrong (tcpdump -i eth0 -nn port 161) Actual results: SNMP fails to set IP address as the IP address is invalid. Expected results: SNMP should set a valid IP address, and the command should succeed. Additional info: Details on how to retrieve data from Cisco devices as per: https://supportforums.cisco.com/docs/DOC-1860 This also occurs on RHEL 6.3 (with older packages).
Created attachment 678654 [details] Test bash script for purposes of tcpdump to verify _valid_ IP address
Upstream bug report: https://sourceforge.net/p/net-snmp/bugs/2436/
This is a 64bit bug, caused by the use of a long (64 bits) for storing 32 bit IP address. Changing this to use in_addr_t instead of long (which will change depending on arch) solves the problem. It's also the type that will be returned by inet_addr(). It would be great to get this fixed, so that IPADDR isn't broken on 64bit machines. Attaching patch for 5.7.2 (also submitted upstream), and a patch for net-snmp.spec
Created attachment 680000 [details] Patch to update net-snmp spec file to apply ipaddr fix.
Created attachment 680001 [details] Patch to fix IPADDR long issue
Thanks for the patch and upstream report!
net-snmp-5.7.2-5.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/net-snmp-5.7.2-5.fc18
Package net-snmp-5.7.2-5.fc18: * should fix your issue, * was pushed to the Fedora 18 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing net-snmp-5.7.2-5.fc18' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-1050/net-snmp-5.7.2-5.fc18 then log in and leave karma (feedback).
net-snmp-5.7.2-5.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.
This could probably also be applied to the f17 package, as the problem exists there too. -c