This fix didn't work for me. Infact, after applying this patch, snmpd
process froze at the following location. The stack trace looks a bit
weird though. According to the stack trace the process got stuck in a
call to free().

(gdb) run  -r -f -C -c /home/riju/tools/scripts/snmpd.conf -d -r -Lo -V
-x 127.0.0.1:7005 -Dagentx udp:8765
Starting program: /tmp/snmp/sbin/snmpd -r -f -C -c
/home/riju/tools/scripts/snmpd.conf -d -r -Lo -V -x 127.0.0.1:7005
-Dagentx udp:8765
agentx/subagent: init_subagent sess 09fc48a8
agentx_register_app_config_handler: registering .conf token for
"agentxsocket"
agentx_register_app_config_handler: registering .conf token for
"agentxperms"
agentx_register_app_config_handler: registering .conf token for
"agentxRetries"
agentx_register_app_config_handler: registering .conf token for
"agentxTimeout"
Turning on AgentX master support.
agentx/master: initializing...
agentx/master: initializing...   DONE
read_config_store open failure on /var/net-snmp/snmpd.conf
read_config_store open failure on /var/net-snmp/snmpd.conf
read_config_store open failure on /var/net-snmp/snmpd.conf
read_config_store open failure on /var/net-snmp/snmpd.conf
read_config_store open failure on /var/net-snmp/snmpd.conf
read_config_store open failure on /var/net-snmp/snmpd.conf

Sending 44 bytes to UDP: [127.0.0.1]:8764
0000: 30 2A 02 01  00 04 06 70  75 62 6C 69  63 A4 1D 06
0*.....public...
0016: 0A 2B 06 01  04 01 BF 08  03 02 0A 40  04 C0 A8 03
[EMAIL PROTECTED]
0032: F4 02 01 00  02 01 00 43  01 0B 30 00                 .......C..0.


Sending 95 bytes to UDP: [127.0.0.1]:8764
0000: 30 5D 02 01  01 04 06 70  75 62 6C 69  63 A7 50 02
0].....public.P.
0016: 04 06 22 E2  0F 02 01 00  02 01 00 30  42 30 0D 06
.."........0B0..
0032: 08 2B 06 01  02 01 01 03  00 43 01 0B  30 17 06 0A
.+.......C..0...
0048: 2B 06 01 06  03 01 01 04  01 00 06 09  2B 06 01 06
+...........+...
0064: 03 01 01 05  01 30 18 06  0A 2B 06 01  06 03 01 01
.....0...+......
0080: 04 03 00 06  0A 2B 06 01  04 01 BF 08  03 02 0A
.....+.........

NET-SNMP version 5.2.1

Received 80 bytes from TCP: [127.0.0.1]:33150
0000: 01 01 00 00  00 00 00 00  00 00 00 00  26 E9 C3 0C
............&...
0016: 3C 00 00 00  00 00 00 00  05 04 00 00  01 00 00 00
<...............
0032: 88 1F 00 00  03 00 00 00  02 00 00 00  0A 00 00 00
................
0048: 19 00 00 00  4E 65 74 2D  53 4E 4D 50  20 41 67 65    ....Net-SNMP
Age
0064: 6E 74 58 20  73 75 62 2D  61 67 65 6E  74 00 00 00    ntX
sub-agent...

agentx/master: handle pdu (req=0xcc3e926,trans=0x0,sess=0x0)
agentx/master: open 0xa04abb8
agentx/master: opened 0xa05b668 = 8 with flags = a0
agentx/master: send response, stat 0 (req=0xcc3e926,trans=0x0,sess=0x0)
agentx_build: packet built okay

Sending 88 bytes to TCP: [127.0.0.1]:33150
0000: 01 12 00 00  08 00 00 00  00 00 00 00  26 E9 C3 0C
............&...
0016: 44 00 00 00  C0 0A 00 00  00 00 00 00  04 00 00 00
D...............
0032: 05 04 00 00  01 00 00 00  88 1F 00 00  03 00 00 00
................
0048: 02 00 00 00  0A 00 00 00  19 00 00 00  4E 65 74 2D
............Net-
0064: 53 4E 4D 50  20 41 67 65  6E 74 58 20  73 75 62 2D    SNMP AgentX
sub-
0080: 61 67 65 6E  74 00 00 00                              agent...


Received 52 bytes from TCP: [127.0.0.1]:33150
0000: 01 03 08 00  08 00 00 00  00 00 00 00  27 E9 C3 0C
............'...
0016: 20 00 00 00  0D 00 00 00  73 6C 73 61  6C 70 68 61
.......slsalpha
0032: 3A 37 38 38  38 00 00 00  00 00 00 00  01 00 00 00
:7888...........
0048: 00 00 00 00                                           ....

agentx/master: handle pdu (req=0xcc3e927,trans=0x0,sess=0x8)
agentx/master: in register_agentx_list
agentx/master: duplicate registration
agentx/master: send response, stat 263
(req=0xcc3e927,trans=0x0,sess=0x8)
agentx_build: packet built okay

Sending 40 bytes to TCP: [127.0.0.1]:33150
0000: 01 12 00 00  08 00 00 00  00 00 00 00  27 E9 C3 0C
............'...
0016: 14 00 00 00  C0 0A 00 00  07 01 00 00  05 00 00 00
................
0032: 01 00 00 00  00 00 00 00                              ........


Program received signal SIGINT, Interrupt.
0x00d76304 in malloc_consolidate () from /lib/tls/libc.so.6
(gdb) where
#0  0x00d76304 in malloc_consolidate () from /lib/tls/libc.so.6
#1  0x00d7619d in _int_free () from /lib/tls/libc.so.6
#2  0x00d75018 in free () from /lib/tls/libc.so.6
#3  0x00a7830b in _sess_read (sessp=0xa03edc0, fdset=0xbfff9360)
    at snmp_api.c:5574
#4  0x00a78594 in snmp_sess_read (sessp=0xa03edc0, fdset=0xbfff9360)
    at snmp_api.c:5625
#5  0x00a7780e in snmp_read (fdset=0xbfff9360) at snmp_api.c:5260
#6  0x0804b712 in receive () at snmpd.c:1149
#7  0x0804b16d in main (argc=14, argv=0xbfffa564) at snmpd.c:993


The subagent process's stack trace at that time is given below:


(gdb) where
#0  0x00cb3c88 in ___newselect_nocancel () from /lib/tls/libc.so.6
#1  0x001d1f9c in snmp_synch_response_cb (ss=0xa31aad0, pdu=0xa31c3f0, 
    response=0xbfffbebc, pcb=0x97ed2c <agentx_synch_input>)
    at snmp_client.c:811
#2  0x0097ef11 in agentx_synch_response (ss=0xa31aad0, pdu=0xa31c3f0, 
    response=0xbfffbebc) at mibgroup/agentx/client.c:116
#3  0x0097f3ce in agentx_register (ss=0xa31aad0, start=0xa31c2b8,
startlen=1, 
    priority=0, range_subid=0, range_ubound=0, timeout=0, flags=0 '\0', 
    contextName=0xa31c350 "slsalpha:7888") at
mibgroup/agentx/client.c:223
#4  0x009720af in agentx_registration_callback (majorID=1, minorID=1, 
    serverarg=0xbfffbfa0, clientarg=0xa31aad0)
    at mibgroup/agentx/subagent.c:575
#5  0x0020ec3f in snmp_call_callbacks (major=1, minor=1,
caller_arg=0xbfffbfa0)
    at callback.c:224
#6  0x00968542 in netsnmp_register_mib (moduleName=0xa31c2c8 "",
var=0x0, 
    varsize=0, numvars=0, mibloc=0xa31c2b8, mibloclen=1, priority=0, 
    range_subid=0, range_ubound=0, ss=0x0, context=0xa31c350
"slsalpha:7888", 
    timeout=0, flags=0, reginfo=0xa31c5b8, perform_callback=1)
    at agent_registry.c:691
#7  0x0096d233 in netsnmp_register_handler (reginfo=0xa31c5b8)
    at agent_handler.c:255
#8  0x0091e08e in netsnmp_register_null_context (loc=0xa31c2b8,
loc_len=1, 
    contextName=0xa31bca0 "slsalpha:7888") at null.c:38
#9  0x00967e26 in netsnmp_subtree_load (new_sub=0xa31bdb8, 
    context_name=0xa31bca0 "slsalpha:7888") at agent_registry.c:397
#10 0x00968387 in netsnmp_register_mib (moduleName=0xa31bc60
"gdcGpsWeek", 
    var=0x0, varsize=0, numvars=0, mibloc=0xa31bcb8, mibloclen=11, 
    priority=127, range_subid=0, range_ubound=0, ss=0x0, 
    context=0xa31bca0 "slsalpha:7888", timeout=0, flags=0,
reginfo=0xa31bc28, 
    perform_callback=1) at agent_registry.c:629
#11 0x0096d233 in netsnmp_register_handler (reginfo=0xa31bc28)
    at agent_handler.c:255
#12 0x0091fe75 in netsnmp_register_serialize (reginfo=0xa31bc28)
    at serialize.c:46
#13 0x0091d061 in netsnmp_register_scalar (reginfo=0xa31bc28) at
scalar.c:91

-----Original Message-----
From: Robert Story [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 15, 2005 3:44 PM
To: Riju Kallivalappil
Cc: [email protected]
Subject: Re: Managing multiple instances of a MIB

On Tue, 15 Feb 2005 10:55:17 -0800 Riju wrote:
RK> On Fri, 11 Feb 2005 16:56:17 -0800 Riju wrote:
RK> RK>  Do SNMP v3 contexts work with agentx in 5.2.1? 
RK> 
RK> Yes, they should.

But apparently they don't. Sigh.

RK> RK> I've been trying to get this work for the past few days. I was
trying
RK> RK> with 5.2 initially. Didn't work. So, I tried upgrading to 5.2.1.
Still
RK> RK> doesn't work. When I turn on the debug level logs I can see that
the
RK> RK> master agent forwards the request to the correct subagent. But,
the
RK> RK> context information doesn't seem to reach the subagent. And
subagent
RK> RK> returns " No Such Object available on this agent at this OID"
error.
RK> RK> 
RK> RK> (This setup works fine when I do not use a context or use the
context
RK> RK> "")

I *know* that I tested this, so I'm not sure how it got broken. But it
does
indeed appear to be broken. Try this simple patch and see if it gets you
going:

Index: mibgroup/agentx/master_admin.c
===================================================================
RCS file:
/cvsroot/net-snmp/net-snmp/agent/mibgroup/agentx/master_admin.c,v
retrieving revision 5.6
diff -u -r5.6 master_admin.c
--- mibgroup/agentx/master_admin.c      9 Nov 2002 15:06:40 -0000
5.6
+++ mibgroup/agentx/master_admin.c      15 Feb 2005 23:41:55 -0000
@@ -229,6 +229,9 @@
 
     reg->handler->myvoid = session;
     reg->global_cacheid = cacheid;
+    if (NULL != pdu->community)
+        reg->contextName = pdu->community;
+
     /*
      * register mib. Note that for failure cases, the registration info
      * (reg) will be freed, and thus is no longer a valid pointer.


-- 
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://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to