It's hard to say without seeing your code, but a common source of problems
like this is using functions that are meant for nul-terminated strings
(e.g., strncpy() ) instead of those meant for moving bytes around (e.g.,
memcpy() ).

  Bill


On Fri, Jan 15, 2021 at 10:06 AM dga via Net-snmp-coders <
net-snmp-coders@lists.sourceforge.net> wrote:

> Hello,
>
> I would like to add more details to clarify the problem.
>
> The 6 fields of mac address are returned to the agent under a string of
> 6 chars: (let's say mac[6])
>
> So for the following mac address : "00:48:65:6C:6C:6F" :
>
> "00" => "NULL" = mac[0]
>
> "48" => "H" = mac[1]
>
> "65" => "e" = mac[2]
>
> "6C" => "l" = mac[3]
>
> "6C" => "l" = mac[4]
>
> "6F" => "o" = mac[5]
>
> it means we have : mac[6] = { '\0', 'H', 'e', 'l', 'l', 'o' , '\0'}
>
> This string (mac[6]) is returned with an other parameter (size_t *
> var_len) to giving the size of the string.  Here the size is 6 of course.
>
> But, when I get the corresponding oid value I get : "Hex-STRING: 00 00
> 00 00 00 00"
>
> It seems to be a bug ...
>
> Best Regards,
>
> Damien GARCIA
>
>
> Le 11/01/2021 à 20:27, dga a écrit :
> > Hello,
> >
> > I have written an snmp module to include additional interfaces in the
> > mib2 interface. However I face an issue with the field "ifPhysAddress"
> > (mac address) if the mac address of the interface starts by "00"
> > (example: "00:06:91:C6:B1:3F"). In that case I get "Hex-STRING: 00 00
> > 00 00 00 00" instead of getting  "Hex-STRING: 00 06 91 C6 B1 3F" . Is
> > it a bug ?
> >
> > I have no issue with my module if the mac address that does NOT start
> > by "00".
> >
> > There is also no issue get mac address starting by "00" for the
> > default interfaces of the snmp demon.
> >
> >
> > May be someone has ever face the same issue ? Any help would be
> > greatly appreciated !
> >
> >
> > Best Regards,
> >
> > Damien GARCIA
> >
> >
>
>
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to