|
Hi Robert,
That is the answer I was looking for, and thank you for sharing the info with me. I'll modify this function in myMacTable_interface.c
int myMacTable_index_from_oid(netsnmp_index * oid_idx, myMacTable_mib_index * mib_idx) { int err = SNMP_ERR_NOERROR;
/* * temp storage for parsing indexes */ /* * myMacAddr(1)/MacAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H */ netsnmp_variable_list var_myMacAddr;
/* * set up varbinds */ memset(&var_myMacAddr, 0x00, sizeof(var_myMacAddr)); var_myMacAddr.type = ASN_PRIV_IMPLIED_OCTET_STR;
/* * chain temp index varbinds together */ var_myMacAddr.next_variable = NULL;
DEBUGMSGTL(("verbose:myMacTable:myMacTable_index_from_oid", "called\n"));
/* * parse the oid into the individual index components */ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, &var_myMacAddr); if (err == SNMP_ERR_NOERROR) { /* * copy out values */ /* * NOTE: val_len is in bytes, myMacAddr_len might not be */ if (var_myMacAddr.val_len > sizeof(mib_idx->myMacAddr)) err = SNMP_ERR_GENERR; else { memcpy(mib_idx->myMacAddr, var_myMacAddr.val.string, var_myMacAddr.val_len); mib_idx->myMacAddr_len = var_myMacAddr.val_len / sizeof(mib_idx->myMacAddr[0]); }
}
Hao Phan Network Administration System Wireless Systems Business Unit M/A-COM Lowell, MA www.macom.com
P: 978-442-4049 F: 978-442-5353
-----Original Message-----
On Mon, 12 Jun 2006 09:36:58 -0700 Wes wrote: WH> Hao> My question is how can I get rid of the 6 (mac address len) so my WH> Hao> index is simply the mac address itself? WH> WH> If the MIB definition for that object is *exactly* 6 octets in length, WH> then it's ok to get rid of it. However, if it's a variable length at WH> all you need to keep it there.
To answer the technical side, if it is defined as a fixed length string, then you need to change the type in the index registration (for MFD code, in *_interface.c). Change the type to ASN_PRIV_IMPLIED_OCTET_STR.
-- NOTE: messages sent directly to me, instead of the lists, will be deleted unless they are requests for paid consulting services.
Robert Story; NET-SNMP Junkie Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp> Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>
You are lost in a twisty maze of little standards, all different. |
_______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
