Hi Thomas,

Thank you for your reply.

On 4/7/07, Thomas Anders wrote:
> Max wrote:
> > I can even do a bulk GET on the NET-SNMP-EXTEND-MIB to call extension
> > scripts, but only if I do a bulk walk of the OID
> >
> > .1.3.6.1.4.1.8072.1.3.2.4.1.2
> >
> > NET-SNMP-EXTEND-MIB::nsExtendOutLine
> >
> > Any attempts to call sub OIDs below that point result in
> >
> > Apr 6 21:56:24 vps287 kernel: snmpd[10550]: segfault at 0000000000000000
> > rip 00002aaaaaadc648 rsp 00007fff7268cb90 error 4

>
> Is it limited to a *bulk* walk? Does "snmpwalk ...
> .1.3.6.1.4.1.8072.1.3.2.4.1.2" work fine? If so, what's the output?


snmpwalk of .1.3.6.1.4.1.8072.1.3.2.4.1.2.2 with just one extend mapping:

[root@webapps bin]# bash !:$
bash test-vps287
enterprises.netSnmp.netSnmpObjects.nsExtensions.2. 4.1.2.1.65.1 =
STRING: "apache:20 mysql:1 named:0 nobody:0 other:6 postgres:0
root:57"

Interesting, with 5.5 dev I can do a walk or get for the above OID and
all works well:

snmpget -v 3 -l authNoPriv -a MD5 -t 30 -Ou -A XXXXXXXXXX -u YYYYYYYY
vps287.nnn.nnn .1.3.6.1.4.1.8072.1.3.2.4.1.2.1.65.1
enterprises.netSnmp.netSnmpObjects.nsExtensions.2. 4.1.2.1.65.1 =
STRING: "apache:20 mysql:1 named:0 nobody:0 other:6 postgres:0
root:56"

snmpwalk -v 3 -l authNoPriv -a MD5 -t 30 -Ou -A XXXXXXXXXX -u
YYYYYYYY vps287.nnn.nnn .1.3.6.1.4.1.8072.1.3.2.4.1.2.1.65.1
enterprises.netSnmp.netSnmpObjects.nsExtensions.2. 4.1.2.1.65.1 =
STRING: "apache:20 mysql:1 named:0 nobody:0 other:6 postgres:0
root:56"

snmpwalk of .1.3.6.1.4.1.8072.1.3.2.4.1.2.2 produces similar results:

On NNM:

snmpwalk -v 3 -l authNoPriv -a MD5 -t 30 -Ou -A XXXXXXXXXX -u
YYYYYYYY vps287.nnn.nnn .1.3.6.1.4.1.8072.1.3.2.4.1.2.1

On managed node:

Apr 7 08:45:29 vps287 kernel: snmpd[23307]: segfault at 0000000000000000
rip 00002aaaaaadc6b8 rsp 00007fff59646bb0 error 4

> Can you narrow it down to a single script that's triggering the segfault?


Any attempt to call any script produces this behaviour. I have a set
of 14 small shell/perl scripts that I have been using over the last
2-3 years with Net-SNMP and SNMP v3. I tried commenting out all but
one and restarting the agent calling each, one at time per run; same
result for each case.

The scripts are mostly very simple, for example, the one that produces
the above output:

#!/usr/bin/perl

use strict;

require "/usr/local/share/ww-snmp/esf-lib.pl";

if ($ARGV[0] eq "--snmp-conf") {
output_oid_conf('/usr/local/share/ww-snmp/bin/s40-procs-by-user.pl',
'1.3.6.1.4.1.2021.8.40');
exit(0);
}

open(my $ps, '/bin/ps -e -x -a -h -o %u 2>/dev/null |') ||
die "Can't read from ps: $!";

my %users = qw(
root 0
mysql 0
postgres 0
nobody 0
apache 0
named 0
);

while (<$ps>) {

chomp($_);

my $user = $_;

if (exists $users{$user}) {
$users{$user}++;
} else {
$users{'other'}++;
}

}

close($ps);

print join(' ', map { "$_:$users{$_}"; } (sort keys %users));

exit 0;

Ok, checked out the latest Net-SNMP code:

svn co https://net-snmp.svn.sourceforge.net...trunk/net-snmp

here is my configure line:

../configure --with-mibs="NET-SNMP-EXTEND-MIB:UCD-SNMP-MIB" \
--with-mib-modules="ucd-snmp/extensible agent/extend" \
--with-defaults \
--enable-ucd-snmp-compatibility \
--with-persistent-directory=/var/net-snmp \
--with-logfile=/var/log/snmp.log \
--enable-shared \
--disable-embedded-perl \
--enable-mfd-rewrites

> Can you try running the agent (5.4 or current SVN, preferrably) under a debugger
> and get us a backtrace, please? See
>
> http://www.net-snmp.org/wiki/index.php/Debugger


Backtrace below.

Thank you again for the help,
Max

(gdb) run -f -Lo -c /usr/local/etc/snmp/snmpd.conf
Starting program: /usr/local/sbin/snmpd -f -Lo -c /usr/local/etc/snmp/snmpd.conf
[Thread debugging using libthread_db enabled]
[New Thread 46912507070080 (LWP 22226)]
duplicate table data attempted to be entered. row exists
NET-SNMP version 5.5.dev

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912507070080 (LWP 22226)]
0x00002aaaaaadc6b8 in handle_nsExtendOutput2Table (
handler=, reginfo=,
reqinfo=0x7d2d00, requests=)
at agent/extend.c:1289
1289 if ( extension->numlines > line_idx )

(gdb) bt
#0 0x00002aaaaaadc6b8 in handle_nsExtendOutput2Table (
handler=, reginfo=,
reqinfo=0x7d2d00, requests=)
at agent/extend.c:1289
#1 0x00002aaaaae003ee in netsnmp_call_handler (next_handler=0x612200,
reginfo=0x612240, reqinfo=0x7d2d00, requests=0x7cbf80)
at agent_handler.c:435
#2 0x00002aaaab03a8ec in table_helper_handler (handler=0x612300,
reginfo=0x612240, reqinfo=0x7d2d00, requests=0x7cbf80) at table.c:633
#3 0x00002aaaaae003ee in netsnmp_call_handler (next_handler=0x612300,
reginfo=0x612240, reqinfo=0x7d2d00, requests=0x7cbf80)
at agent_handler.c:435
#4 0x00002aaaaadf3a1e in handle_var_requests (asp=0x7ca3e0)
at snmp_agent.c:2504
#5 0x00002aaaaadf5371 in handle_pdu (asp=0x7ca3e0) at snmp_agent.c:3293
#6 0x00002aaaaadf6018 in netsnmp_handle_request (asp=0x7ca3e0,
status=) at snmp_agent.c:3089
#7 0x00002aaaaadf6be7 in handle_snmp_packet (op=,
session=, reqid=,
pdu=, magic=)
at snmp_agent.c:1854
#8 0x00002aaaab27e5bf in _sess_process_packet (sessp=0x71bcb0,
sp=0x7cd2f0, isp=0x71bce0, transport=,
opaque=, olength=,
packetptr=0x800de0
"0\201\213\002\001\0030\021\002\004\033h!\204\002\0 03", length=142) at
snmp_api.c:5370
#9 0x00002aaaab28022d in _sess_read (sessp=0x71bcb0,
fdset=, fds=,
nfds=) at snmp_api.c:5840
#10 0x00002aaaab280dad in snmp_sess_read (sessp=0x8123d0, fdset=0x7cfb20)
at snmp_api.c:5857
#11 0x00002aaaab280df3 in snmp_read (fdset=0x7fffa53ddb20)
at snmp_api.c:5422
#12 0x0000000000404306 in main (argc=,
argv=) at snmpd.c:1174

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?p...rge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders