Magnus,
I followed your suggestion , coded this up and tested. This works for all
old UCD style MIB registrations that need to be unregistered. I can send a
patch for UCD-DLMOD if that is required. Let me know. Thanks
#define MY_UNREGISTER_MIB(var, mibloc)
             \
    do{
                \
        size_t varsize = sizeof(struct variable2);
                 \
        struct variable2 *vp;
                \
        oid myoid[MAX_OID_LEN];
                \
        size_t length;
                 \
        int    i, result;
                \
        int    numvars = sizeof(var)/varsize;
                \
        int    mibloclen = sizeof(mibloc)/sizeof(oid);
                 \
        for (i=0; i < numvars; i++) {
                \

                \
            vp = (struct variable2 *)((char *)var + varsize * i);
                \

                \
            memcpy(myoid, mibloc, mibloclen * sizeof(oid));
                \
            memcpy(myoid+mibloclen, vp->name, vp->namelen * sizeof(oid));
                \
            length = mibloclen + vp->namelen;
                \
            result = unregister_mib(myoid, length);
                \
            if (result != MIB_UNREGISTERED_OK) {
                 \
                snmp_log(LOG_ERR, "%s: unregistering failed:%d\n",
__FUNCTION__, result);   \
            }
                \
            else {
                 \
                snmp_log(LOG_DEBUG, "%s: unregistering succeeded\n",
__FUNCTION__);         \
            }
                \
        }
                \
    }while(0);


On Thu, Mar 21, 2013 at 12:26 PM, Pal Saint <[email protected]> wrote:

> >I'd say the easiest way forward is to convert to a handler-based table.
> Thanks Magnus.
> Could you explain a little bit more on how to do this? Perhaps with an
> example. Thanks.
>
>
> On Tue, Mar 19, 2013 at 2:09 PM, Magnus Fromreide <[email protected]>wrote:
>
>> On Tue, 2013-03-19 at 10:20 -0700, Pal Saint wrote:
>> > The problem I mentioned was noticed even with UCD-DLMOD registration
>> > and unregistration code (agent/mibgroup/ucd-snmp/dlmod.c).
>> >
>> >
>> > Here is the example code I compiled and was able to reproduce on my
>> > Linux 2.6.32 (64bit).
>> > I am using net-snmp-5.7.2.
>> >
>> Thanks. This made me understand the problem. In effect it seems old_api
>> can't be unregistered, and since it can't be unregistered it cant be
>> unloaded from dlmod since unloading it would result in the master
>> crashing when it tries to access the code that should be there but
>> isn't.
>>
>> I'd say the easiest way forward is to convert to a handler-based table.
>>
>> It should be possible to write an unregister-old function that takes the
>> same array as REGISTER_MIB, iterates over it and builds the same oid's
>> and then unregisters them but it seems nobody have done that yet.
>>
>> /MF
>>
>>
>>
>
------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to