Re: MAC Address As Index

Krishna Chaitanya <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CABPxzYKLRfWQ1WF+q3ZsDdJ+VXsrVR0AJ-4BsNaTxEDm1AX+xg@mail.gmail.com>
On Tue, Sep 3, 2019 at 5:23 PM Krishna Chaitanya
<[email protected]> wrote:
>
> On Tue, Aug 27, 2019 at 2:12 PM Krishna Chaitanya
> <[email protected]> wrote:
> >
> > On Mon, Aug 26, 2019 at 9:22 PM Bill Fenner <[email protected]> wrote:
> > >
> > > On Tue, Aug 20, 2019 at 8:45 AM Krishna Chaitanya <[email protected]> wrote:
> > >>
> > >> Hi,
> > >>
> > >> When using MAC Address as an index ( I am using MacAddress type from
> > >> SNMPv2-TC.) the output is incorrect because the length of the string
> > >> is prefixed as mac address is defined as OCTET STR there is an extra
> > >> byte and the last byte of mac address is interpreted as next OID.
> > >>
> > >> snmpwalk:
> > >>    HistValue."wlp8s0f0".'....B.'.hist_2.2.19
> > >> snmpwalk -OX
> > >>   HistValue["wlp8s0f0"][STRING: 06:00:90:e6:42:99][hist_2][2].19
> > >>
> > >> In the above examples last but one OID 2 is hist_2. Is there a way to
> > >> disable prefixing of length?
> > >
> > >
> > > The prefixing of length is done by the agent.  Are you asking about a MIB module that you implemented?  Try changing your object definition from ASN_OCTET_STR to ASN_PRIV_IMPLIED_OCTET_STR.
> > Yes, I am using my own MIB and changing to ASN_PRIV_IMPLIED_OCTET_STR
> > in the subagent worked.
> > Thanks, Bill.
>
> After this change, I was getting a lot of duplicate data exists
> errors, upon further debugging found a similar issue
> which is quite old
> https://www.mail-archive.com/[email protected]/msg06286.html.
> In the current code even though there is support to handle IMPLIED
> strings, but subsequent indexes are not processed.
> See snippet below: out of 4 indexes only 2 are processed (the indexes
> after ASN_PRIV_IMPLIED_OCTET_STR
> failed to parse. Any ideas?
>
> histStatsData: Request Mode is: 160 name: wlp8s0f0 col: 3
> histStatsData: Add row
> duplicate table data attempted to be entered. row exists
> helper:table:req: Got GETNEXT (161) mode request for handler table:
> base oid:SNMPv2-SMI::mib-2.43932.2.2
> helper:table:col:   have at least a column (3)
> helper:table:     have 17 bytes of index
> helper:table:   looking for 4 indexes
>
> parse_oid_indexes: Parsed str(4): wlp8s0f0
> helper:table:   got 1 (incomplete=0)
>
> parse_oid_indexes: Parsed str(196):
> helper:table:   got 1 (incomplete=0)
>
> helper:table:   oid indexes not complete:
> SNMPv2-SMI::mib-2.43932.2.2.1.3.8.119.108.112.56.115.48.102.48.0.128.225.66.153.1.2.15
> helper:table:results:   found 2 indexes
> helper:table:results:   column: 3, indexes: 2   index: type=4(04),
> value=STRING: "wlp8s0f0"   index: type=196(c4), value=Variable has bad
> type
>

As a workaround moved the MAC address index to last and it works fine
with ASN_IMPLIED_OCTER_STR, this should be good enough for parsing
programmatically, but
for end-user its a bit counter-intuitive, having MAC Address as the
2nd index out of 4 is
more readable. This was the diff in MIB:

-  INDEX { ifaceName, remoteMAC, HistClass, HistBinIndex}
+  INDEX { ifaceName, HistClass, HistBinIndex, remoteMAC}
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.