On Sun, 21 Nov 2004 22:06:56 +0000 Dave wrote:
DS> DS> The 'create_row' hook
DS> DS> seems to activate the automatic creation of rows ... But this
DS> DS> isn't what's needed for a pure RowStatus-controlled table.
DS>
DS> RS> Hmm... ok, what is needed?
DS>
DS> Well, as I understand it, there are two basic techniques for
DS> creating a new row in a table. One approach is to SET the
DS> value of a missing instance, and for this to trigger the creation
DS> of the corresponding row ("automatic creation").
DS> The other is to SET the relevant RowStatus column instance to
DS> either 'createAndWait' or 'createAndGo', and for *this* to be
DS> the trigger for creating the row.
Ok, the array-user stuff supports both.
If the create_row funtion pointer in non-NULL, any time a request comes in for
a new index, a new row is created by the helper. This takes care of the first
case.
If mib2c sees a RowStatus variable, extra code is put in reserve2 and at the
bottom of the action function. The code in reserve2 should cause an error if
row creation is attempted with a bogus rowstatus value (like active), and the
code in action calls netsnmp_table_array_check_row_status, which checks row
status transitions and should fail if createAndGo is specified but the
can_activate routine indicates the row isn't ready.
The generated code could be tweaked to detect completely invalid RowStatus
creation attempts (eg no RowStatus varbind in the request) in reserve1 fairly
easily, thus saving 2 mode calls for every module called for the request.
DS> But with a pure RowStatus implementation, I don't *want* the row
DS> to be created unless something (the RS-handling routine) explicitly
DS> sets the 'ag->row_created' flag to trigger it.
DS>
DS> Now I may have misunderstood how the 'create_row' routine is being
DS> invoked, but it looks as if it's being a little too trigger happy.
DS> Unless there's a way to calm it down a bit?
No, you will always take the hit of creating the row. It isn't until later
that the invalid row creation attempt will be detected, and the helper will
delete the row that it created.
The idea was that the user module shouldn't have to worry about
creating/deleting rows. They simple implement the functions that all the helper
to do that work. The set mode callbacks are *always* called with a valid row
context, even if it is a new one that isn't in the container yet.
I'll argue that the convenience of having the row context always available
outweighs the performance hit of an extra allocate/delete for invalid set
attempt. Sets are relatively infrequent, and hopefully invalid ones are even
more infrequent.
There are two other RowStatus related bug, due to a misunderstanding of
createAndWait. There are two issues - one easy, and one complex. The
complex one makes the easy one less easy. If createAndWait is specified and
a column without a default value is not specified in the varbind, the row will
be notReady until all rows have a value specified. A get for such a column
should return noSuchInstance. Once all columns have values, the row transitions
to notInService.
The array-user code does not track what columns do not have default values, and
does not track which ones have been set via SNMP. It also stay in the notReady
state until can_activate succeed, at which point it will transition to
notInService. The easy fix is to immediately transition to notInService instead
of notReady. The complex fix would require a way of tracking which object had
be set, and dealing with the noSuchInstance behaviour.
I've just submitted a bug report for that, but don't expect to get around to
fixing it real soon...
--
Robert Story; NET-SNMP Junkie
Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>
You are lost in a twisty maze of little standards, all different.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders