Hi everyone,
I still have below problem, i hope someone can tell me what is going
on.
I would very much appreciate it. I can supply log or code if you need
it.
It seems to be reproducable. I really like to think it is a bug but i
can't fathom
the idea no one uses this same setup (snmpv1 code and ipAdEntNetMask).
Many thanks for anyone who wants to put their time into it.
Kind regards,
Alef
Begin forwarded message:
From: Alef Veld <[EMAIL PROTECTED]>
Date: December 11, 2006 3:01:05 PM GMT+01:00
To: Net-Snmp- Subagent <net-snmp-coders@lists.sourceforge.net>
Subject: followup 2: snmpget: Error building ASN.1 representation
It seems that it only occurs when checking a mib instance of type
"Ip Address". Is it because i'm using SNMPv1 maybe ?
Begin forwarded message:
From: Alef Veld <[EMAIL PROTECTED]>
Date: December 10, 2006 10:53:25 PM GMT+01:00
To: Net-Snmp- Subagent <net-snmp-coders@lists.sourceforge.net>
Subject: followup: snmpget: Error building ASN.1 representation
Strange phenomena. I checked if it might work with the OID
instead, so i did:
root# snmpwalk -On -v 2c -c public localhost ipAdEntNetMask
.1.3.6.1.2.1.4.20.1.3.10.0.0.151 = IpAddress: 255.255.255.0
.1.3.6.1.2.1.4.20.1.3.127.0.0.1 = IpAddress: 255.0.0.0
So i got the OID alright. I put that in the oid string instead,
and what do i get as output?
IP-MIB::ipForwarding.0 = INTEGER: notForwarding(2)
IP-MIB::ipForwarding.0 = INTEGER: notForwarding(2)
Instead of getting the .1.3.6.1.2.1.4.20.1.3 OID, it gets the
ipforwarding OID again, which, as you can see below, is really
different. I can only guess that it 'autocompletes' the OID and
gets the nearest OID that matches. After all both ipforwarding and
ipAdEntNetMask belong to the same IP-MIB. I can do a snmpwalk with
just ipFor as value as well, works just as good.
In any case, i find it strange that it does not work for the
string (ipAdEntNetMask) although a full snmpwalk does tell me it's
there, and that it does respond to the OID but doesn't get the
right value (which hints at me that the ipAdEntNetMask isn't there?)
I hope i'm still making sense :-)
root# snmpwalk -On -v 2c -c public localhost ipForwarding .
1.3.6.1.2.1.4.1.0 = INTEGER: notForwarding(2)
Begin forwarded message:
From: Alef Veld <[EMAIL PROTECTED]>
Date: December 10, 2006 3:45:39 PM GMT+01:00
To: Net-Snmp- Subagent <net-snmp-coders@lists.sourceforge.net>
Subject: snmpget: Error building ASN.1 representation
Can anyone tell me why i get :
snmpget: Error building ASN.1 representation
upon running the following code? I just added an extra OID to
query by using snprintf to fill a variable with the OID and the
ipaddress. Is the buffer to big ? MAX_MSG=256
GLvoid snmp_walk(char *ip_addr)
{
struct snmp_session session, *ss;
struct snmp_pdu *pdu;
struct snmp_pdu *response;
struct hostent *he;
oid anOID[MAX_OID_LEN];
size_t anOID_len = MAX_OID_LEN;
struct variable_list *vars;
int status;
int count=1;
char *oids[OIDS];
/* For variable OID instances */
char varbla_buffer[MAX_MSG];
database *data;
int i;
/* SNMPv2-MIB */
oids[0]="sysDescr.0";
oids[1]="sysUpTime.0";
oids[2]="sysContact.0";
oids[3]="sysName.0";
oids[4]="sysLocation.0";
/* IP-MIB */
oids[5]="ipForwarding.0";
snprintf(varbla_buffer,sizeof(varbla_buffer),"ipAdEntNetMask.%
s",ip_addr);
fprintf(stderr,"varbuffer: %s lenght: %d\n",varbla_buffer,strlen
(varbla_buffer));
oids[6]=varbla_buffer;
/* IF-MIB */
oids[7]="ifNumber.0";
-------------------------------------------------------------------------
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?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders