On Mon, 18 Oct 2010 19:21:21 +0200 Niels wrote:
NB> But not any more backwards than the network address 007AA8C0 ...
NB> 
NB> So I still wonder why it is treated different from the network address. 
NB> What does that look like on the PPC?

True. I poked around in the source and the debugger. The big difference is
that for some reason we store the address/dest as char buffers, but the mask
in an u_int. Following the twisty little maze, later everything is passed
around as a long, and then a memcpy is used to set the oid/value. Try this
patch, which seems to work on my 32 bit ppc and x86 boxes:

diff --git a/net-snmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c 
b/net-snmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c
index 80acc3e..21ea80e 100644
--- a/net-snmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c
+++ b/net-snmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c
@@ -72,7 +72,7 @@ _load_ipv4(netsnmp_container* container, u_long *index )
     while (fgets(line, sizeof(line), in)) {
         char            rtent_name[32];
         int             refcnt, rc;
-        uint32_t        dest, nexthop, mask, tmp_mask;
+        uint32_t        dest, nexthop, mask;
         unsigned        flags, use;
 
         entry = netsnmp_access_route_entry_create();
@@ -89,7 +89,7 @@ _load_ipv4(netsnmp_container* container, u_long *index )
                      * XXX: fix type of the args 
                      */
                     &flags, &refcnt, &use, &entry->rt_metric1,
-                    &tmp_mask);
+                    &mask);
         DEBUGMSGTL(("9:access:route:container", "line |%s|\n", line));
         if (8 != rc) {
             snmp_log(LOG_ERR,
@@ -122,10 +122,8 @@ _load_ipv4(netsnmp_container* container, u_long *index )
          */
         entry->ns_rt_index = ++(*index);
 
-        mask = htonl(tmp_mask);
-
 #ifdef USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE
-        entry->rt_mask = mask;
+        memcpy(&entry->rt_mask, &mask, 4);
         /** entry->rt_tos = XXX; */
         /** rt info ?? */
 #endif
@@ -143,6 +141,7 @@ _load_ipv4(netsnmp_container* container, u_long *index )
         /*
          * count bits in mask
          */
+        mask = htonl(mask);
         entry->rt_pfx_len = netsnmp_ipaddress_ipv4_prefix_len(mask);
 
 #ifdef USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to