[prev in list] [next in list] [prev in thread] [next in thread]
List: net-snmp-patches
Subject: [Net-snmp-patches] [ net-snmp-Patches-839627 ] patch for unregister_mib() returns incorrect result
From: "SourceForge.net" <noreply () sourceforge ! net>
Date: 2004-01-30 14:20:03
Message-ID: E1AmZV5-000253-00 () sc8-sf-web1 ! sourceforge ! net
[Download RAW message or body]
Patches item #839627, was opened at 2003-11-10 18:27
Message generated for change (Comment added) made by slif
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=312694&aid=839627&group_id=12694
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: patch for unregister_mib() returns incorrect result
Initial Comment:
I was using the 4.2.X based APIs for register_mib() and
unregister_mib(). Recently I've upgraded the toolkit to
5.0.8 and found out the return code for unregister_mib()
is incorrect (MIB_NO_SUCH_REGISTRATION), though I'm
sure the registration is there. In fact, after I modified
the searching algorithm in unregister_mib_context(), the
unregistration is now successful:
Original code: (line 881-895 of agent_registry.c)
// Commented out by elam on 11/7/03
// for (list = myptr->next; list != NULL; list = list-
>next) {
// for (child = list, prev = NULL; child != NULL;
// prev = child, child = child->children) {
// if ((netsnmp_oid_equals(child->name_a, child-
>namelen,
// name, len) == 0) &&
// (child->priority == priority)) {
// netsnmp_subtree_unload(child, prev);
// netsnmp_subtree_free(child);
// break;
// }
// }
// if (child == NULL) /* Didn't find the given
name */
// break;
// }
// netsnmp_subtree_free(myptr);
New code:
// Added by elam on 11/7/03
for (list = list->next; list != NULL; list = list->next)
{
// No need to check priority since we always
register with
// the default priority
if ((netsnmp_oid_is_subtree(name, len, list-
>start_a,
list->start_len) == 0))
{
// Delete the toolkit injected (bulk_to_next) child
if present
if ((child = list->children) != NULL)
{
netsnmp_subtree_unload(child, list);
netsnmp_subtree_free(child);
}
// Update the "end" field of the previous node
free(list->prev->end_a);
list->prev->end_a = (oid*) malloc(list->end_len
* sizeof(oid));
memcpy(list->prev->end_a, list->end_a, list-
>end_len * sizeof(oid));
list->prev->end_len = list->end_len;
// Time to delete itself
netsnmp_subtree_unload(list, NULL);
netsnmp_subtree_free(list);
}
}
// end of addition by elam on 11/7/03
elam@qualcomm.com (Eric Lam)
----------------------------------------------------------------------
>Comment By: Michael J. Slifcak (slif)
Date: 2004-01-30 09:20
Message:
Logged In: YES
user_id=88697
please modify a copy of net-snmp-5.1,
without the commented out code,
then provide a patch
diff -ru net-snmp-5.1 your-modified-net-snmp-5.1
uploaded through
http://sourceforge.net/tracker/index.php?func=detail&aid=839627&group_id=12694&atid=312694
Thanks!
-MIke Slifcak
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=312694&aid=839627&group_id=12694
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Net-snmp-patches mailing list
Net-snmp-patches@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic