-Coders,
the attached patch finally fixes the infamous IP address byte order bug
for udpTable also (and cleans up what looks like a copy-n-paste leftover
from tcpTable that's not used anywhere else). The patch has already been
put into MAIN and V5-1-patches and affects Linux only. I'm hereby
calling for votes whether it should go into 5.2.2 also.
*Without* the patch:
RFC1213-MIB::udpLocalAddress.1.0.0.127.8161 = IpAddress: 1.0.0.127
RFC1213-MIB::udpLocalPort.1.0.0.127.8161 = INTEGER: 8161
*With* the patch:
RFC1213-MIB::udpLocalAddress.127.0.0.1.8161 = IpAddress: 127.0.0.1
RFC1213-MIB::udpLocalPort.127.0.0.1.8161 = INTEGER: 8161
Tested on Linux/x86. More testing welcome (will definitely be done in
case we decide to put into 5.2.2).
+Thomas
--
Thomas Anders (thomas.anders at blue-cable.de)
Index: ./agent/mibgroup/mibII/udpTable.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/mibII/udpTable.c,v
retrieving revision 5.12.2.3
diff -u -r5.12.2.3 udpTable.c
--- ./agent/mibgroup/mibII/udpTable.c 27 Sep 2005 21:24:11 -0000 5.12.2.3
+++ ./agent/mibgroup/mibII/udpTable.c 20 Oct 2005 17:36:52 -0000
@@ -474,8 +474,9 @@
if (state != 7) /* fix me: UDP_LISTEN ??? */
continue;
+ /* store in network byte order */
+ pcb.inp_laddr.s_addr = htonl(pcb.inp_laddr.s_addr);
pcb.inp_lport = htons((unsigned short) (lport));
- pcb.inp_fport = htons(pcb.inp_fport);
nnew = SNMP_MALLOC_TYPEDEF(struct inpcb);
if (nnew == NULL)