On Mon, 6 Dec 2004 09:38:19 +0100 P wrote:
PK> When my commit() function is called and MFD_ROW_CREAT is set I do some 
PK> ,,aplication specyfic'' acctions. I don't touch cache, container or
PK> so. My problem is that newly created row is not in snmpwalk result befere
PK> cache is reloaded. Is it mfd bug or i should touch cache in some way when
PK> adding new row ? I'm using rc3 version os net-snmp

Well,it could be considered a bug. My original intent was that the user should
be responsible for inserts and deletes. The safest fix would be to invalidate
the cache in the post request function, so the next walk will re-load the
cache.

I do have a patch in my local CVS to auto-delete in the post request
function, since that's easier than doing a remove/re-insert in
commit/commit-undo. It is trivial to add auto-insert as well.

Here's the patch to mib2c, should be easy to figure out how to tweak your
interface.c file to match.

Index: local/mib2c-conf.d/mfd-interface.m2c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/local/mib2c-conf.d/mfd-interface.m2c,v
retrieving revision 1.43
diff -u -r1.43 mfd-interface.m2c
--- local/mib2c-conf.d/mfd-interface.m2c        18 Oct 2004 02:56:55 -0000     
1.43+++ local/mib2c-conf.d/mfd-interface.m2c        7 Dec 2004 16:00:39 -0000
@@ -499,11 +499,21 @@
     }

     /*
-     * if it was set, clear row created flag.
+     * if there are no errors, check for and handle row creation/deletion
      */
-    rowreq_ctx = netsnmp_container_table_row_extract(requests);
-    if ((NULL != rowreq_ctx) && (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
-        rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+    rc = netsnmp_check_requests_error(requests);
+    if ((SNMP_ERR_NOERROR == rc) &&
+        (NULL !=
+         (rowreq_ctx = netsnmp_container_table_row_extract(requests)))) {
+        if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+            rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+            CONTAINER_INSERT(${context}_if_ctx.container, rowreq_ctx);
+        }
+        else if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+            CONTAINER_REMOVE(${context}_if_ctx.container, rowreq_ctx);
+            ${context}_release_rowreq_ctx(rowreq_ctx);
+        }
+    }

     return SNMP_ERR_NOERROR;
 } /* _mfd_${context}_post_request */

-- 
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

Reply via email to