Thomas Anders wrote:
[EMAIL PROTECTED] wrote:
FreeBSD:
udpTable: IP value reported correctly, index reversed
tcpTable: reported correctly
[agent requires root access]
Requires root access? I can access both tables as non-root just fine on
FreeBSD 5.4 (w/ "snmpd -r").
Sorry - you're correct. This works OK with FreeBSD.
It's just NetBSD and OpenBSD that require full root access.
NetBSD:
udpTable: IP value and index both reversed
tcpTable: bogus contents
[agent requires root access]
OpenBSD:
udpTable: IP value and index both reversed
tcpTable: bogus contents
[agent requires root access]
Can you please add
#define UDP_ADDRESSES_IN_HOST_ORDER 1
to include/net-snmp/system/openbsd.h and
include/net-snmp/system/netbsd.h and try again?
Adding this line to 'include/net-snmp/system/netbsd.h'
is sufficient to fix the value on both systems, as expected.
(Note that openbsd.h explicitly includes netbsd.h)
At the end, we're still left with the udpTable indices being reversed on
at least (Open|Net|Free)BSD and Solaris/x86 (but not Solaris/SPARC). Ideas?
I've been comparing the UDP table with the equivalent code in the TCP table,
which seems to be working correctly. I thought I'd got a patch that
fixed the
problem on *BSD systems, but it breaks Linux :-(
I'm attaching a patch that seems to give the correct results on *BSD and
Linux, but I don't really like it....
Dave
Index: udpTable.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/mibII/udpTable.c,v
retrieving revision 5.23
diff -u -r5.23 udpTable.c
--- udpTable.c 23 Jun 2006 16:06:56 -0000 5.23
+++ udpTable.c 26 Jun 2006 13:48:09 -0000
@@ -106,8 +106,10 @@
#ifdef UDP_ADDRESSES_IN_HOST_ORDER
#define CONVERT_ADDRESS(x) x
+#define TREVNOC_ADDRESS(x) ntohl(x)
#else
#define CONVERT_ADDRESS(x) ntohl(x)
+#define TREVNOC_ADDRESS(x) x
#endif
#ifdef UDP_PORTS_IN_HOST_ORDER
@@ -293,9 +295,14 @@
/*
* Set up the indexing for the specified row...
*/
- port = CONVERT_ADDRESS((u_long)udp_head[i].UDPTABLE_LOCALADDRESS);
+#if defined (WIN32) || defined (cygwin)
+ port = ntohl((u_long)udp_head[i].UDPTABLE_LOCALADDRESS);
snmp_set_var_value(index, (u_char *)&port,
sizeof(udp_head[i].UDPTABLE_LOCALADDRESS));
+#else
+ snmp_set_var_value(index, (u_char *)&udp_head[i].UDPTABLE_LOCALADDRESS,
+ sizeof(udp_head[i].UDPTABLE_LOCALADDRESS));
+#endif
port = CONVERT_PORT((u_short)udp_head[i].UDPTABLE_LOCALPORT);
snmp_set_var_value(index->next_variable,
(u_char*)&port, sizeof(port));
@@ -366,7 +373,8 @@
(u_char*)&IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr),
sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)));
#else
- snmp_set_var_value(index, (u_char*)&entry->UDPTABLE_LOCALADDRESS,
+ port = TREVNOC_ADDRESS((u_long)entry->UDPTABLE_LOCALADDRESS);
+ snmp_set_var_value(index, (u_char *)&port,
sizeof(entry->UDPTABLE_LOCALADDRESS));
#endif
port = CONVERT_PORT(entry->UDPTABLE_LOCALPORT);
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders