snmpdemo core dump when sending traps

Hi,

I am investigating the SEA SNMP toolkit on Solaris x86 7 & 8. I applied the recommended patches on both of my systems. Everything worked fine except the traps.

I modified the mib_demo.txt by adding a test trap definition:

myTestTrap TRAP-TYPE

ENTERPRISE demo

VARIABLES {

demoEntryInteger

}

DESCRIPTION "This is a test trap."

::= 2

Then I used mibcodgen to generate the code, and modified agent_loop() in snmpdemo_appl.c to let it send the trap in every agent_loop. It compiled okay, but it core dumped when it ran into _SSASendTrap3(...) in snmpdemo_trap.c. The _SSASendTrap3 looks like a SDK function that I have no clue how it processes inside.

I noticed if I change "demoEntryInteger" into "demoInteger" - to change the variable(s) from table attribute(s) to non-table attribute(s), and followed the same build process, the snmpdemod worked fine - I was able to get the traps on the destination host without core dump.

I discovered this problem several weeks ago on Solaris 7, and now I found the same on Solaris 8.

I think it is quite common for a subagent to bind some variables to the enterprise-specific traps. And the variables can be attributes of a talbe entry. And this is exactly the case of the subagent which I am going to work on.

Any clue? Could it be a SDK defect? Or is there any newer patch which has already fixed this problem?

Or any way to hack _SSASendTrap3 so that I can get around it?

Thanks a lot!

Wen

[1554 byte] By [wensophieyang] at [2007-11-26 5:53:05]
# 1
It works by using _SSASendTrap4( char *, IndexType * ) instead of _SSASendTrap3( char * ).No matter the trap variables are table attributes or not, the mibcodegen always uses _SSASendTrap3 when generating the code.It would be nice if this can be improved in next patch.
wensophieyang at 2007-7-6 13:04:32 > top of Java-index,Administration Tools,Solstice Enterprise Agents...
# 2

Hi Wen,

I am working on Solaris 8 and I have the same problem. What I did to find why it crash on trap_send is:

Change Makefile to have a debug mode CFLAGS= -c -g start snmpdx with debud mode (-d 4)

Start your agent with DBX if you have it...

stop into the function get_demoEntryInteger and look at the content of variables in arguments

(dbx 11) p search_type

search_type = -4264572

(dbx 10) p *demoEntryInteger

dbx: reference through nil pointer

That's mean demoEntryInteger doesn't have any memory allocate.

That is weird no?

Danielle

sona82 at 2007-7-6 13:04:32 > top of Java-index,Administration Tools,Solstice Enterprise Agents...
# 3
> It works by using _SSASendTrap4( char *, IndexType * )> instead of _SSASendTrap3( char * ).How? _SSASendTrap(char *, IndexType *) long-jumps into oblivion whenever I try it. Can someone please provide an example?
andyc_2k at 2007-7-6 13:04:32 > top of Java-index,Administration Tools,Solstice Enterprise Agents...
# 4
Where should I tell the program to use _SSASendTrap4 instead of _SSASendTrap3?Thank you.
ipandres at 2007-7-6 13:04:32 > top of Java-index,Administration Tools,Solstice Enterprise Agents...
# 5
Nevermind, i just found it in trap.c file.:S
ipandres at 2007-7-6 13:04:32 > top of Java-index,Administration Tools,Solstice Enterprise Agents...
# 6
I don't see how to use " SSASendTrap4(char *name, IndexType *index_obj)".I don't know what to give in the index_obj parameter.Any help, please?Thankx.
ipandres at 2007-7-6 13:04:32 > top of Java-index,Administration Tools,Solstice Enterprise Agents...