Loading a particular MIB causes init_snmp to crash

2010-08-10 Thread Gaurav Chaturvedi
Hi,

I am using net-snmp v5.5. On loading a particular MIB (attached with the
mail), my program crashes on init_snmp API.
On removing this MIB from the MIB directory, everything works fine.

Please share your views on what may be the issue in this case.

Thanks and Regards
Gaurav Chaturvedi


CLARIION-MIB
Description: Binary data
--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


SNMP demo app

2010-08-10 Thread Сергей Владимирович
Hi!
In your demo application 
(http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demoapp/snmpdemoapp.c) you 
fill the field session.peername using strdup function. 

init_snmp(snmpdemoapp);

/*
 * Initialize a session that defines who we're going to talk to
 */
snmp_sess_init( session );   /* set up defaults */
session.peername = strdup(test.net-snmp.org);

/* set up the authentication parameters for talking to the server */


Where do you release memory which were allocated by this function?

Regards, Sergei

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Loading a particular MIB causes init_snmp to crash

2010-08-10 Thread Dave Shield
On 10 August 2010 08:14, Gaurav Chaturvedi gauravchaturve...@gmail.com wrote:
 I am using net-snmp v5.5. On loading a particular MIB (attached with the
 mail), my program crashes on init_snmp API.
 On removing this MIB from the MIB directory, everything works fine.

 Please share your views on what may be the issue in this case.

Well the obvious error in this MIB is in the TRAP-TYPE definition:

   EventMonitorTrap TRAP-TYPE
  ENTERPRISE  EMC CLARiiON Advanced Storage Solutions
  VARIABLES   { .}
  DESCRIPTION
  
  ::= 2


The ENTERPRISES clause is meant to contain the object identifier (name
or numeric OID) of the defining enterprise.   It's not an arbitrary string.
See RFC1215, section 2.2.1 for a typical example.

That's almost certainly the cause of the crash.
There are some other errors as well
   (OBJECT-TYPE should probably be imported from RFC1212 rather than 1155,
TRAP-TYPE is not imported at all, and the EventMonitorTrap name is
invalid - it needs to start with a lower-case letter)
but I doubt those are likely to cause any real problems.

It'll be the bogus enterprise value that's hitting you - try replacing
it with 'clariion'
and see if that works any better.

Dave

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Loading a particular MIB causes init_snmp to crash

2010-08-10 Thread Gaurav Chaturvedi
Hi,

Thanks for the response. I know the error in MIB file (same as specified by
Dave), but should an erroneous value in MIB crash the application?

I want to know some way that can report error on MIB and exit/write a log.

Thanks and Regards
Gaurav Chaturvedi
(+91) 957-944-3976


On Tue, Aug 10, 2010 at 1:29 PM, Dave Shield d.t.shi...@liverpool.ac.ukwrote:

 On 10 August 2010 08:14, Gaurav Chaturvedi gauravchaturve...@gmail.com
 wrote:
  I am using net-snmp v5.5. On loading a particular MIB (attached with the
  mail), my program crashes on init_snmp API.
  On removing this MIB from the MIB directory, everything works fine.
 
  Please share your views on what may be the issue in this case.

 Well the obvious error in this MIB is in the TRAP-TYPE definition:

   EventMonitorTrap TRAP-TYPE
  ENTERPRISE  EMC CLARiiON Advanced Storage Solutions
  VARIABLES   { .}
  DESCRIPTION
  
  ::= 2


 The ENTERPRISES clause is meant to contain the object identifier (name
 or numeric OID) of the defining enterprise.   It's not an arbitrary string.
 See RFC1215, section 2.2.1 for a typical example.

 That's almost certainly the cause of the crash.
 There are some other errors as well
   (OBJECT-TYPE should probably be imported from RFC1212 rather than 1155,
TRAP-TYPE is not imported at all, and the EventMonitorTrap name is
invalid - it needs to start with a lower-case letter)
but I doubt those are likely to cause any real problems.

 It'll be the bogus enterprise value that's hitting you - try replacing
 it with 'clariion'
 and see if that works any better.

 Dave

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Loading a particular MIB causes init_snmp to crash

2010-08-10 Thread Dave Shield
On 10 August 2010 09:25, Gaurav Chaturvedi gauravchaturve...@gmail.com wrote:
 Thanks for the response. I know the error in MIB file (same as specified by
 Dave), but should an erroneous value in MIB crash the application?

No - of course it shouldn't.
The MIB parser wasn't written in the expectation of such a broken MIB,
and really needs to be tightened up.


 I want to know some way that can report error on MIB and exit/write a log.

The first step is to investigate what exactly is causing the parser to crash,
and fix that.   If you can provide a suitable patch, then we would be happy to
include it in the code for future releases.

Dave

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Providing an ifTable through a subagent

2010-08-10 Thread Tsolakos Stavros
Hi all.

I am taking my very first steps in subagent development.

I have developed a subagent which provides the ifTable to a master agent
that already provides its own ifTable. So, I edited
/etc/sysconfig/snmpd.options and added these: -Dmib_init -I -ifTable

I can now see that snmpd does not provide its own ifTable any longer but
when I run my subagent, despite successfully connecting to the master, I
can not read the ifTable provided by the subagent.

My question: Does the -I -ifTable option prevents access to the ifTable
even if provided by a subagent? I have followed the mfd tutorial steps,
as described here:

http://www.net-snmp.org/tutorial/tutorial-5/toolkit/mfd/if-mib/ifTable/index.html

Thank you very much for your help! My apologies if I was not clear
enough. Just tell me to try rephrasing it again...

Regards,

Stavros

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Loading a particular MIB causes init_snmp to crash

2010-08-10 Thread Gaurav Chaturvedi
Hi Dave,

Sure, I am trying to fix this. Will provide the same soon.

In the meantime, if anybody is able to provide a fix/work-around for this,
it will be highly appreciated.

Thanks and Regards
Gaurav Chaturvedi


On Tue, Aug 10, 2010 at 2:21 PM, Dave Shield d.t.shi...@liverpool.ac.ukwrote:

 On 10 August 2010 09:25, Gaurav Chaturvedi gauravchaturve...@gmail.com
 wrote:
  Thanks for the response. I know the error in MIB file (same as specified
 by
  Dave), but should an erroneous value in MIB crash the application?

 No - of course it shouldn't.
 The MIB parser wasn't written in the expectation of such a broken MIB,
 and really needs to be tightened up.


  I want to know some way that can report error on MIB and exit/write a
 log.

 The first step is to investigate what exactly is causing the parser to
 crash,
 and fix that.   If you can provide a suitable patch, then we would be happy
 to
 include it in the code for future releases.

 Dave

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Providing an ifTable through a subagent

2010-08-10 Thread Dave Shield
On 10 August 2010 10:07, Tsolakos Stavros stsola...@gmail.com wrote:
 Does the -I -ifTable option prevents access to the ifTable
 even if provided by a subagent?

No.
The option '-I-ifTable' when given to the main agent simply means
  don't invoke the routine 'init_ifTable'

The effect of this is that the main agent won't try to register the ifTable,
leaving the way clear for your subagent to provide this information.

The problem will lie elsewhere - either in how your subagent registers
with the master agent, or in how it responds to queries for this table.

I would suggest that the ifTable is a fairly complicated table to start
with.   It would probably be a good idea to try with a simpler demo table
first, and make sure you can register and query that successfully,
before moving on to more compilcated tables.

Dave

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Wrong Type (should be INTEGER): NULL

2010-08-10 Thread Deepali Singalkar
HI,

I have implemented an AgentX subagent.

The mib is standard Q-BRIDGE_MIB, node is

dot1qVlanVersionNumber OBJECT-TYPE

SYNTAX INTEGER {

version1(1)

}

MAX-ACCESS read-only

STATUS current

DESCRIPTION

The version number of IEEE 802.1Q that this device

supports.

REFERENCE

IEEE 802.1Q/D11 Section 12.10.1.1

::= { dot1qBase 1 }



I have generated the code using mib2c dot1qVlanVersionNumber

1.net-snmp style

2. Both ways scalar and tied integer.

code generated and modified from mib2c.scalar.conf is

long dot1qVlanVersionNumber = 1; /* XXX: set default value */

/*

* Our initialization routine, called automatically by the agent

* (Note that the function name must match init_FILENAME())

*/

void

init_dot1qVlanVersionNumber(void)

{

static oid dot1qVlanVersionNumber_oid[] = { 1,3,6,1,2,1,17,7,1,1,1 };

DEBUGMSGTL((dot1qVlanVersionNumber, Initializing\n));

netsnmp_register_scalar(

netsnmp_create_handler_registration(dot1qVlanVersionNumber,
handle_dot1qVlanVersionNumber,

dot1qVlanVersionNumber_oid, OID_LENGTH(dot1qVlanVersionNumber_oid),

HANDLER_CAN_RONLY

));

}

int handle_dot1qVlanVersionNumber(netsnmp_mib_handler *handler,

netsnmp_handler_registration *reginfo,

netsnmp_agent_request_info *reqinfo,

netsnmp_request_info *requests)

{

switch(reqinfo-mode) {

case MODE_GET:

case MODE_GETNEXT:

snmp_set_var_typed_value(requests-requestvb, ASN_INTEGER,

(u_char *) dot1qVlanVersionNumber/* XXX: a pointer to the scalar's data */,

sizeof(long)/* XXX: the length of the data in bytes */);

break;



default:

/* we should never get here, so this is a really bad error */

snmp_log(LOG_ERR, unknown mode (%d) in handle_dot1qVlanVersionNumber\n,
reqinfo-mode );

return SNMP_ERR_GENERR;

}

return SNMP_ERR_NOERROR;

}





When I do snmpwalk I get

snmpwalk -v3 -u xyz -A 12345678 -X 12345678 -a MD5 -l authNoPriv localhost
Q-BRIDGE-MIB::dot1qVlanVersionNumber

Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = INTEGER: version1(1)

Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = Wrong Type (should be INTEGER):
NULL

Error: OID not increasing: Q-BRIDGE-MIB::dot1qVlanVersionNumber.0

= Q-BRIDGE-MIB::dot1qVlanVersionNumber.0

snmpget is working fine

snmpget -v3 -u xyz -A 12345678 -X 12345678 -a MD5 -l authNoPriv localhost
Q-BRIDGE-MIB::dot1qVlanVersionNumber.0

Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = INTEGER: version1(1)

This behaviour is same when code is generated using tied integer.

Why I am getting Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = Wrong Type (should
be INTEGER): NULL

Error: OID not increasing: Q-BRIDGE-MIB::dot1qVlanVersionNumber.0

= Q-BRIDGE-MIB::dot1qVlanVersionNumber.0

in snmpwalk output?

I searched for this in archive and found that this is probably due to my
agent is broken.
Can you please help me out in figuring Where is agent broken and how to fix
it?

Thanks in advance!
--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem

2010-08-10 Thread Kathy McLeod
Hi -

For the -1, I was referring to the value in the .h file.  For example,
#define LLDPLOCMANADDRTABLE_TIMEOUT  60

Change the 60 to -1.  The mib2c with the cache option generates a default
value (in this case, 60) and you can adjust it.  I haven't tried the on
the fly option yet.

There is another mib2c for scalars - mib2c.scalar.conf.


Kathy McLeod


   
 Alexander King  
 new...@foxmail.c 
 omTo 
   Kathy McLeod/Rochester/i...@ibmus,   
 08/06/2010 04:52  net-snmp-users
 AMnet-snmp-us...@lists.sourceforge.n 
   et 
cc 
   
   Subject 
   Re: Re: net-snmp init_XXX() get 
   data periodically( or cyclic )  
   problem 
   
   
   
   
   
   




Thank you all kind man!

I will do my best get a prototype the way Dave teaching me ASAP.


Also, I thought -1 was the value for load every time.
I saw the letter later Dave's wrote back,is it the meaning use mib2c -S
cache=-1 -c mib2c.iterate.conf uit can get the really data on the
fly???and how about the saclars data?


I got a little inspiration,I think.





--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: OCTET STRING Size -SNMP-V3

2010-08-10 Thread Wes Hardaker

The maximum length of an OCTET STRING is 65535.  However, it's unlikely
you want to send that much data over UDP, however.
-- 
Wes Hardaker
Cobham Analytic Solutions

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: implementing traps...

2010-08-10 Thread Wes Hardaker
 On Thu, 5 Aug 2010 14:01:21 +0530 (IST), ganeshyell...@bel.co.in said:

g after this what to edit in coldStart.c?

You'll need to call the created function from within your code where you
want the trap to be sent.

The coldStart.c file is likely mostly complete unless you want to add
additional variables, like the comments talk about.

-- 
Wes Hardaker
Cobham Analytic Solutions

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


SNMP Make error

2010-08-10 Thread Ernie Lacson
Hi,

 

While running: make test, I get the following error. 

 

 

Thanks in advance for any help you provide.

 

 

make test

making all in /usr/local/src/net-snmp/net-snmp-5.5/snmplib

making all in /usr/local/src/net-snmp/net-snmp-5.5/agent

/bin/bash ../libtool --mode=compile gcc -I../include -I. -I../agent
-I../agent/mibgroup  -I../snmplib -I/usr/local/ssl/include -g -O2
-Usolaris2 -Dsolaris2=solaris2 -c -o snmp_vars.lo snmp_vars.c

libtool: compile:  gcc -I../include -I. -I../agent -I../agent/mibgroup
-I../snmplib -I/usr/local/ssl/include -g -O2 -Usolaris2
-Dsolaris2=solaris2 -c snmp_vars.c  -fPIC -DPIC -o .libs/snmp_vars.o

In file included from /usr/include/kvm.h:14,

 from kernel.h:11,

 from snmp_vars.c:143:

/usr/include/sys/proc.h:202: error: syntax error before p_t1_lgrpid

/usr/include/sys/proc.h:203: error: syntax error before p_tr_lgrpid

/usr/include/sys/proc.h:337: error: syntax error before '}' token

In file included from kernel.h:11,

 from snmp_vars.c:143:

/usr/include/kvm.h:44: error: syntax error before '*' token

/usr/include/kvm.h:45: error: syntax error before '*' token

/usr/include/kvm.h:48: error: syntax error before proc_t

*** Error code 1

make: Fatal error: Command failed for target `snmp_vars.lo'

Current working directory /usr/local/src/net-snmp/net-snmp-5.5/agent

*** Error code 1

The following command caused the error:

if test snmplib  agent apps man local mibs != ; then \

it=snmplib  agent apps man local mibs ; \

for i in $it ; do \

echo making all in `pwd`/$i; \

( cd $i ; make ) ; \

if test $? != 0 ; then \

exit 1 ; \

fi  \

done \

fi

make: Fatal error: Command failed for target `subdirs'

 

 

Regards,

Ernie

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


RE: SNMP Make error

2010-08-10 Thread Mike Ayers
 From: Ernie Lacson [mailto:elac...@successfactors.com]
 Sent: Tuesday, August 10, 2010 2:12 PM

[SNIP]
 In file included from /usr/include/kvm.h:14,
 
  from kernel.h:11,
 
  from snmp_vars.c:143:
 
 /usr/include/sys/proc.h:202: error: syntax error before p_t1_lgrpid
 
 /usr/include/sys/proc.h:203: error: syntax error before p_tr_lgrpid
 
 /usr/include/sys/proc.h:337: error: syntax error before '}' token
[/SNIP]

Looks like the problem is in your include headers.  Try compiling a 
minimal app that includes kvm.h - that should fail as well.


HTH,

Mike

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


What is this OID?a very strange,long OID problem.

2010-08-10 Thread Alexander King
Hi,
  
 Like previous mails,I got the generated code use  mib2c -S cache=-1 -c 
mib2c.iterate.conf ,but I got  NetsnmpCachefree  type comflict problem,in my 
uit.c file, I deleted the  int  return type keyword before the XXXcachefree 
function, then the compiling wrong cleared, it make me very happly.
  
 and then I run make install command got snmpd snmptrapd executable program 
and run it in my device,every time when I use MG-soft walk the whole 
MIB-tree,the snmpd corrupted when the browser run the OID( something like the 
attachment,the red line in the pic).
  
 I cannot find where my code is wrong,and what the OID's value is.
  
 Help me !
  
 alexattachment: Snap1.jpg
--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users