Hi all,
I'm having some trouble interpreting the data type for ifPhysAddress for
the ifTable. I get that if a 6 byte data format and it seems ok in the
code. But the agent crashes when i walk the ifTable. In th agent I
interprete the mac address as an octet string but it doesn't seem to be
returning the right length. I know i'm missing a line but where?
Code :
char mac_addr[6];
memcpy(sysinfo.mac_addr,(unsigned char *) &if_hwaddr.ifr_hwaddr.sa_data,6);
//adding ifPhysAddress into the ifTable spcifying type TR_MIB_STR to be
interpreted by the agent
tr_mib_add_item(context, 6, "mac", "physical address",
TR_MIB_STR,TR_MIB_RO, NULL, NULL, NULL, 0, 0, &(sysinfo.mac_addr), 0);
Agent code :
case TR_MIB_STR :
value = (char *) val->s;
if (!value) {
value = "";
}
TR_DEBUG_D(TR_SNMP_DEBUG_REQ, "Returning value type
ASN_OCTET_STR, value %s", value);
snmp_set_var_typed_value(idx, ASN_OCTET_STR, value, strlen(value));
Thanks!! Any feedback is greatly appreciated.
Syikin
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users