SNMPGetTable get's the entries in the table pointed to by OID. In our case
OID= .iso.org.dod.internet.mgmt.mib-2.ip.ipRouteTable. The entries are
....ipRouteTable.ipRouteEntry  and elements are
....ipRouteTable.ipRouteEntry.ipRouteDest, etc. To group elements in an
entry you drop the ipRouteDest,etc which is what fetch(row, '.') does. 
If you want one line per route you'll need to a SNMPGetTable of
1.3.6.1.2.1.4.21.1 instead of 1.3.6.1.2.1.4.21.1.1. You'll get all the
elements per line (next hop, mask, etc.)  but that is similar to the
"Routing table" tab in Getif. In other words: the ipRouteTable is made up of
ipRouteEntry's, not of ipRouteDest's.
 
So, SNMPGetTable gets you the table at OID (ie. entries below OID). What you
are looking for is a filter on replies starting with OID.
 
Ludo
 
 

-----Message d'origine-----
De : John Repucci [mailto:john.repu...@gmail.com] 
Envoyé : vendredi 15 juillet 2011 03:36
À : Ararat Synapse
Objet : Re: [Synalist] RE : SNMPGetTable error?


I'm now using v4 and I have the same issue.

I added two routes to my test router: 10.0.0.0/32 & 12.0.0.0/8 and
SNMPGetTable returns both of them on one line as "10.0.0.0","12.0.0.0".  

The above routes are clearly not default routes and they should not be
combined.

This appears to happen because SNMPGetList sets the index variable x to 0
for any route whose 2,3 & 4 octet's = '0.0.0'  and the following code
combines routes thus identified into row 0.

The function   row := separateright(oid, baseoid + '.');    does return the
correct and full IP address, but after col := fetch(row, '.');   row only
contains the last three octets.  Fetch appears to remove the 1st octet from
the string contained in "row".
"col" does not appear to be used. 

If I comment out the col := fetch(row, '.');  line, SNMPGetTable works as
expected.

What is that line doing and does it need to be there?


Variable values for the 12.0.0.0 route 
BASEOID:  0x5f0704 '1.3.6.1.2.1.4.21.1.1'
OID:       0x5b2f0 '1.3.6.1.2.1.4.21.1.1.12.0.0.0'

ROW  0x3b14b20 '0.0.0'

Network/Mask        Proto        Age Slot     Cost  NextHop Address     AS
------------------- ------ --------- ---- --------- ---------------- -----
10.0.0.0/32         Static        40    1         1 192.168.170.254
12.0.0.0/8          Static         4    1         1 192.168.170.254
192.168.170.128/25  Direct     12562    1         0 192.168.170.254
192.168.255.78/32   Direct     12562    1         0 192.168.255.78





------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to