Re: related tables design

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
On 23/01/2008, Xuan Pan <[email protected]> wrote:
> Finally I am stuck in front of an error, Internal error in type switching.
> It occurs:
>
> snmp_set_var_value(pIndex, (u_char *)& lpDhcpEntry->index, sizeof(int));
> pIndex = pIndex->next_variable;
> // Before this!!!!!
> snmp_set_var_value(pIndex, (u_char *)& lpIpRangeEntry->index, sizeof(int));


Where *exactly* does this error occur?
Try running the agent under a debugger.

    $ gdb snmpd
    gdb> b getNextIpRangeContext     {or wherever it is choking}
    gdb> run -f -Le    {plus any other options you might need}


Then run a single "snmpgetnext -r 0 -t 6000 ..." query against this agent,
and single step through the routine until you hit this error.
   What does the structure pointed to by 'pIndex' look like at that point?



> I doubt the error is caused by not registering two indexes correctly by
> using netsnmp_table_helper_add_indexes(pTableInfo, ASN_INTEGER,
> ASN_INTEGER, 0);

That looks OK at first sight.


> I can't find a tutorial or any documentation about this API. I use a '0'
> for the last argument because I read an example comment from the table.c
> saying this function can take a variable index parameter list. I wonder
> what the last argument '0' stands for.

It markes the end of the list of indexes.   There can be an arbitrary number
of them, so the netsnmp_table_helper_add_indexes() needs some way to
detect when it's finished processing.   0 is not a valid SNMP type enumeration,
so can mark the end of the list.


>                                                    I have tried to
> generate some debug information in the line "//Before this!!!!!" What I
> know is pIndex is not NULL and trying pIndex->type also gives me the same
> error.

But what value does pIndex->type actually hold?
And which assignment is triggering the problem?

Dave

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.