MacAddress type

Francois Bouchard <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAAZiaZeJridCsRpSJ1Eq3K-R93reSWJfkteYqmg49WeB5z1faw@mail.gmail.com>
Hi list,

Question about one MacAddress SNMP oject type we have in the MIB.

When sending a snmpget request to the MacAddress Object with the textual
names:

$ snmpget -v 3 -u  ......  MPBC-RMH-MIB::mpbcRMHMacAddress.0 we get garbage:
MPBC-RMH-MIB::mpbcRMHMacAddress.0 = STRING:
36:43:3a:46:46:3a:42:45:3a:30:31:3a:30:30:3a:31:35

Then, if sending the getsnmp to the same object, but using the OID we get
the correct value "6C:FF:BE:01:00:15":
$ snmpget -v 3 -u ...  .1.3.6.1.4.1.4464.2.1.4.1.5.0
SNMPv2-SMI::enterprises.4464.2.1.4.1.5.0 = STRING: "6C:FF:BE:01:00:15"


So in the code I should limit the string to 6 Bytes.  So must I omit the
colon separated string when writing (see C source)?

Thanks,

Francois


>From the C source:

  // Get MAC, format : "11:22:33:44:55:66"
    if(!Exec_Popen_Cmd(s_mac_addr, sizeof(s_mac_addr), "ifconfig -a eth0 |
grep HWaddr | awk ' {print $5}'"))
    {
        strcpy(s_mac_addr, "??:??:??:??:??:??");
    }


    /* We are never called for a GETNEXT if it's registered as a
       "instance", as it's "magically" handled for us.  */

    /* a instance handler also only hands us one request at a time, so
       we don't need to loop over a list of requests; we'll only get one. */

    switch(reqinfo->mode) {

        case MODE_GET:

            snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
s_mac_addr, strlen(s_mac_addr));     // the length of the data in bytes
            break;


        default:
            /* we should never get here, so this is a really bad error */
            snmp_log(LOG_ERR, "unknown mode (%d) in
handle_mpbcRMHMacAddress\n", reqinfo->mode );
            return SNMP_ERR_GENERR;
    }

(...)

------------------------------------------------------------------------------
How fast is your code?
3 out of 4 devs don\\\'t know how their code performs in production.
Find out how slow your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219672;13503038;z?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html

_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.