hi there, 

i'm having problems from a response to a SNMPGET. I'm trying to get back the a 
mac address from the .ifPhysAddress(.*) from the interface table in MIB-2. The 
mac address response value can be seen from ethereal as 0:d:bd:e7:7c:81, but 
the printf is just returning a blank string.
 
Below is the code part for manipulating teh returned variable

for(vars = response->variables; vars; vars = vars->next_variable) {
        if (vars->type == ASN_OCTET_STR) {
          char *sp = (char *)malloc(1 + vars->val_len);
          memcpy(sp, vars->val.string, vars->val_len);
          sp[vars->val_len] = '\0';
          printf("value #%d is a string: %s\n", count++, sp);
          free(sp);
        }

regards
ian dineen


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to