Discussion:
snmpset - Octet string
surya ravi kiran k
2002-02-18 20:37:07 UTC
Permalink
Hi,

Sorry if this topic was discussed else where, couldnt find a proper previous thread.

Using the snmp api, how can octet strings be SET?. i have an object
(forwarding mac address) whose value is of the type ASN_OCTET_STRING.
when a call to snmp_add_var is made should the call look something like
snmp_add_var(pdu, obj, objlen, 's', buf)
where buf is an unsigned char string?


when using snmpset tool for this object, the command
snmpset <host> -c <string> <objid> 00aabbccddee fails..
where the mac address is 00:aa:bb:cc:dd:ee

any suggestions..

thanks
ksr



Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com
Niels Baggesen
2002-02-18 20:41:03 UTC
Permalink
Post by surya ravi kiran k
Using the snmp api, how can octet strings be SET?. i have an object
(forwarding mac address) whose value is of the type ASN_OCTET_STRING.
when a call to snmp_add_var is made should the call look something like
snmp_add_var(pdu, obj, objlen, 's', buf)
where buf is an unsigned char string?
when using snmpset tool for this object, the command
snmpset <host> -c <string> <objid> 00aabbccddee fails..
where the mac address is 00:aa:bb:cc:dd:ee
The 's' is for a printable string. For your mac address example you
should use 'x', as in
snmpset <host> -c <string> <objid> x 00aabbccddee

/Niels
--
Niels Baggesen - @home - Århus - Denmark - ***@baggesen.com
-- All people smile in the same language --
Niels Baggesen
2002-02-18 21:49:02 UTC
Permalink
Post by Niels Baggesen
snmpset <host> -c <string> <objid> x 00aabbccddee
Oops, that what I get for cut-and-paste'int too much. You must have -c
string befor host, as in

snmpset -c <string> <host> <objid> x 00aabbccddee

/Niels
--
Niels Baggesen - @home - Århus - Denmark - ***@baggesen.com
-- All people smile in the same language --
Niels Baggesen
2002-02-18 21:46:03 UTC
Permalink
[ First - *please* don't mail me directly. I don't have
the time or inclination to offer private, unpaid, SNMP
consultancy. Keep discussions to the list, where others
can both learn and offer advice. Thanks. ]
x: Bad object type..
No, it does not, unless you mistyped the command. Exact command and
error message, please!
unsigned char mac[]={00, aa, bb, cc, dd, ee};
using the snmp api, snmp_add_var(pdu, obj, len, 'x', mac) and send the pdu results in a value of all zeros being set.. has it got to handle or do something with the leading value of 00 which is interpreted as a NULL value?
If you use the snmp_add_var function, you must pass the value in the
form as on the snmpset command:

char mac[] = "00aabbccddee";

If you have the binary format you must use the snmp_pdu_add_variable
function.

/Niels
--
Niels Baggesen - @home - Århus - Denmark - ***@baggesen.com
-- All people smile in the same language --
Loading...