Hi,

I am using net-snmp 5.4 and implementing shared udpTable wherein the master
registers the table at root OID using the table iterator helper.
Subagent however registers the table rows using netsnmp_table_row_register.

The question that i want to ask is if there a way I can send the master
agent some error code so that it will
skip over all the subsequent row handlers. I tried sending SNMP_ENDOFMIBVIEW
but still the getnext goes through all the row handlers.

Below is the sequence of steps

1. udpTable (1.3.6.1.2.1.5.7) is indexed on IP Address and Port combination.
For simplicity lets assume that udpTable on Master is empty and on subagent
it has 2 rows.

   udpLocalAddress udpLocalPort
   127.0.0.55      4006
   127.0.0.56      9000

2. Master agent registers at table OID using table iterator(existing netsnmp
implementation)
   Subagent registers its rows with master agent using
netsnmp_table_row_register with the following OIDs and range_subid.
   For 1st Row: OID = 1.3.6.1.2.1.5.7.1.1.127.0.0.55.4006, range_subid = 10,
range_ubound = 2
   For 2nd Row: OID = 1.3.6.1.2.1.5.7.1.1.127.0.0.56.9000, range_subid = 10,
range_ubound = 2

3. For every row, I register a handler also which takes care of the GET
processing only.

4. Actual registration is done by making a call to
netsnmp_sub_table_row_register() function. This function internally also
registers a default handler _table_row_handler() which gets called before my
handler is called.

Now when I issue snmpwalk on the udpTable, the following is the flow

1. Master agent send agentX GetNext PDU towards subagent with searchRange
and two varbinds – OID 1.3.6.1.2.1.5.7.1.1.127.0.0.55.4006 (with include
field = 1) and OID 1.3.6.1.2.1.5.7.1.1.127.0.0.55.4007 (with include field
0) in single PDU.
2. On subagent this GETNEXT is resolved to GET Request by net-snmp itself
and our default handler _table_row_handler() gets GET Request for OID
1.3.6.1.2.1.5.7.1.1.127.0.0.55.4006 which calls my handler which in turns
correctly returning the first column value i.e 127.0.0.55 in this case.
3. Subagent sends this column value in the response PDU to Master agent.
4. Now Master again sends agentX GetNext PDU towards subagent like step 1
above with the difference in inclusion field – OID
1.3.6.1.2.1.5.7.1.1.127.0.0.55.4006 (with include field = 0) and
1.3.6.1.2.1.5.7.1.1.127.0.0.55.4007 (with include field 0) in single PDU.
5. This time on subagent GETNEXT is not resolved to GET request and the
GETNEXT request is passed though _table_row_handler() for all the rows. I
tried to return SNMP_ENDOFMIBVIEW in _table_row_handler() if the mode is
GETNEXT but still no agentX response PDU returned at this point and the
request traverses to the next row handler. So in the worst case we will have
_table_row_handler() getting called for max number of rows in table.
6. Only when the request has traversed through all the udpTable row handlers
and other MIB handlers, agentX response PDU is formed with varbind value to
indicate end of mib view.
7. Master Agent then repeat from step 1 with OID
1.3.6.1.2.1.5.7.1.1.127.0.0.56.9000 (with include field = 1) and OID
1.3.6.1.2.1.5.7.1.1.127.0.0.56.9001 (with include field 0) in single PDU.


Basically i am trying to oprtimize the Step 5, if somehow i can stop the
getnext request from traversing the other row handlers. Any suggestions?

Thanks,
Manu
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to