Re: MAC Address As Index

2019-09-17 Thread Krishna Chaitanya
On Tue, Sep 17, 2019 at 5:09 PM Krishna Chaitanya
 wrote:
>
> On Tue, Sep 17, 2019 at 4:51 PM Bill Fenner  wrote:
> >
> > On Tue, Sep 17, 2019 at 4:27 AM Krishna Chaitanya 
> >  wrote:
> >>
> >> On Tue, Sep 17, 2019 at 5:18 AM Bill Fenner  wrote:
> >> >
> >> > You can do this if you use snmp_varlist_add_variable() to create the 
> >> > index info (you can't use netsnmp_table_helper_add_indexes).  The code 
> >> > would be something like
> >> >
> >> > table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
> >> > snmp_varlist_add_variable(_info->indexes,
> >> >   NULL,
> >> >   0,
> >> >   ASN_TYPE_OF_IFACE_NAME,
> >> >   NULL,
> >> >   0);
> >> > snmp_varlist_add_variable(_info->indexes,
> >> >   NULL,
> >> >   0,
> >> >   ASN_IMPLIED_OCTET_STR,
> >> >   "XX",
> >> >   6);
> >> > snmp_varlist_add_variable(_info->indexes,
> >> >   NULL,
> >> >   0,
> >> >   ASN_TYPE_OF_HIST_CLASS,
> >> >   NULL,
> >> >   0);
> >> > snmp_varlist_add_variable(_info->indexes,
> >> >   NULL,
> >> >   0,
> >> >   ASN_TYPE_OF_HISTBIN_INDEX,
> >> >   NULL,
> >> >   0);
> >> >
> >> Thanks, Bill. I was using  "netsnmp_table_set_add_indexes" for the
> >> initial addition (don't have access to index_data but only type),
> >
> >
> > You should be able to replace "table_info" above by "tset->table" and add 
> > the 4 calls to snmp_varlist_add_variable in place of the call to 
> > "netsnmp_table_set_add_indexes".
> Yes.
> >> and then when the data is available I either use
> >> "netsnmp_table_dataset_replace_row/netsnmp_table_dataset_add_row"
> >> using the API "netsnmp_table_row_add_index" for index.
> >
> >
> > This will continue to work.  The real difference is setting vp->val_len in 
> > the indexes that you supply when you're registering the table.  For most 
> > types this is not relevant but for the ASN_PRIV_IMPLIED types if you do not 
> > set the length, as you saw it will consume the whole rest of the data and 
> > not parse the indexes from the OID after that.
> Okay, I will try that, in my case the Len is fixed anyway.
I just gave a dummy string with proper len while adding the
table_data_index and gave proper string and len while
adding the row index, it seems to be working fine.

Thanks a lot for the help, Bill.


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-17 Thread Krishna Chaitanya
On Tue, Sep 17, 2019 at 4:51 PM Bill Fenner  wrote:
>
> On Tue, Sep 17, 2019 at 4:27 AM Krishna Chaitanya  
> wrote:
>>
>> On Tue, Sep 17, 2019 at 5:18 AM Bill Fenner  wrote:
>> >
>> > You can do this if you use snmp_varlist_add_variable() to create the index 
>> > info (you can't use netsnmp_table_helper_add_indexes).  The code would be 
>> > something like
>> >
>> > table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
>> > snmp_varlist_add_variable(_info->indexes,
>> >   NULL,
>> >   0,
>> >   ASN_TYPE_OF_IFACE_NAME,
>> >   NULL,
>> >   0);
>> > snmp_varlist_add_variable(_info->indexes,
>> >   NULL,
>> >   0,
>> >   ASN_IMPLIED_OCTET_STR,
>> >   "XX",
>> >   6);
>> > snmp_varlist_add_variable(_info->indexes,
>> >   NULL,
>> >   0,
>> >   ASN_TYPE_OF_HIST_CLASS,
>> >   NULL,
>> >   0);
>> > snmp_varlist_add_variable(_info->indexes,
>> >   NULL,
>> >   0,
>> >   ASN_TYPE_OF_HISTBIN_INDEX,
>> >   NULL,
>> >   0);
>> >
>> Thanks, Bill. I was using  "netsnmp_table_set_add_indexes" for the
>> initial addition (don't have access to index_data but only type),
>
>
> You should be able to replace "table_info" above by "tset->table" and add the 
> 4 calls to snmp_varlist_add_variable in place of the call to 
> "netsnmp_table_set_add_indexes".
Yes.
>> and then when the data is available I either use
>> "netsnmp_table_dataset_replace_row/netsnmp_table_dataset_add_row"
>> using the API "netsnmp_table_row_add_index" for index.
>
>
> This will continue to work.  The real difference is setting vp->val_len in 
> the indexes that you supply when you're registering the table.  For most 
> types this is not relevant but for the ASN_PRIV_IMPLIED types if you do not 
> set the length, as you saw it will consume the whole rest of the data and not 
> parse the indexes from the OID after that.
Okay, I will try that, in my case the Len is fixed anyway.


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-17 Thread Bill Fenner
On Tue, Sep 17, 2019 at 4:27 AM Krishna Chaitanya 
wrote:

> On Tue, Sep 17, 2019 at 5:18 AM Bill Fenner  wrote:
> >
> > You can do this if you use snmp_varlist_add_variable() to create the
> index info (you can't use netsnmp_table_helper_add_indexes).  The code
> would be something like
> >
> > table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
> > snmp_varlist_add_variable(_info->indexes,
> >   NULL,
> >   0,
> >   ASN_TYPE_OF_IFACE_NAME,
> >   NULL,
> >   0);
> > snmp_varlist_add_variable(_info->indexes,
> >   NULL,
> >   0,
> >   ASN_IMPLIED_OCTET_STR,
> >   "XX",
> >   6);
> > snmp_varlist_add_variable(_info->indexes,
> >   NULL,
> >   0,
> >   ASN_TYPE_OF_HIST_CLASS,
> >   NULL,
> >   0);
> > snmp_varlist_add_variable(_info->indexes,
> >   NULL,
> >   0,
> >   ASN_TYPE_OF_HISTBIN_INDEX,
> >   NULL,
> >   0);
> >
> Thanks, Bill. I was using  "netsnmp_table_set_add_indexes" for the
> initial addition (don't have access to index_data but only type),
>

You should be able to replace "table_info" above by "tset->table" and add
the 4 calls to snmp_varlist_add_variable in place of the call to
"netsnmp_table_set_add_indexes".

and then when the data is available I either use
> "netsnmp_table_dataset_replace_row/netsnmp_table_dataset_add_row"
> using the API "netsnmp_table_row_add_index" for index.
>

This will continue to work.  The real difference is setting vp->val_len in
the indexes that you supply when you're registering the table.  For most
types this is not relevant but for the ASN_PRIV_IMPLIED types if you do not
set the length, as you saw it will consume the whole rest of the data and
not parse the indexes from the OID after that.

  Bill
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-17 Thread Krishna Chaitanya
On Tue, Sep 17, 2019 at 5:18 AM Bill Fenner  wrote:
>
> You can do this if you use snmp_varlist_add_variable() to create the index 
> info (you can't use netsnmp_table_helper_add_indexes).  The code would be 
> something like
>
> table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
> snmp_varlist_add_variable(_info->indexes,
>   NULL,
>   0,
>   ASN_TYPE_OF_IFACE_NAME,
>   NULL,
>   0);
> snmp_varlist_add_variable(_info->indexes,
>   NULL,
>   0,
>   ASN_IMPLIED_OCTET_STR,
>   "XX",
>   6);
> snmp_varlist_add_variable(_info->indexes,
>   NULL,
>   0,
>   ASN_TYPE_OF_HIST_CLASS,
>   NULL,
>   0);
> snmp_varlist_add_variable(_info->indexes,
>   NULL,
>   0,
>   ASN_TYPE_OF_HISTBIN_INDEX,
>   NULL,
>   0);
>
Thanks, Bill. I was using  "netsnmp_table_set_add_indexes" for the
initial addition (don't have access to index_data but only type),
and then when the data is available I either use
"netsnmp_table_dataset_replace_row/netsnmp_table_dataset_add_row"
using the API "netsnmp_table_row_add_index" for index.

I guess it all boils down to using netsnmp_table_data_add_index (using
only types) Vs netsnmp_table_row_add_index (types and indexes).


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-16 Thread Bill Fenner
You can do this if you use snmp_varlist_add_variable() to create the index
info (you can't use netsnmp_table_helper_add_indexes).  The code would be
something like

table_info = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
snmp_varlist_add_variable(_info->indexes,
  NULL,
  0,
  ASN_TYPE_OF_IFACE_NAME,
  NULL,
  0);
snmp_varlist_add_variable(_info->indexes,
  NULL,
  0,
  ASN_IMPLIED_OCTET_STR,
  "XX",
  6);
snmp_varlist_add_variable(_info->indexes,
  NULL,
  0,
  ASN_TYPE_OF_HIST_CLASS,
  NULL,
  0);
snmp_varlist_add_variable(_info->indexes,
  NULL,
  0,
  ASN_TYPE_OF_HISTBIN_INDEX,
  NULL,
  0);


  Bill


On Mon, Sep 16, 2019 at 10:23 AM Krishna Chaitanya 
wrote:

> On Tue, Sep 3, 2019 at 5:23 PM Krishna Chaitanya
>  wrote:
> >
> > On Tue, Aug 27, 2019 at 2:12 PM Krishna Chaitanya
> >  wrote:
> > >
> > > On Mon, Aug 26, 2019 at 9:22 PM Bill Fenner  wrote:
> > > >
> > > > On Tue, Aug 20, 2019 at 8:45 AM Krishna Chaitanya <
> chaitanya.m...@gmail.com> 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/net-snmp-coders@lists.sourceforge.net/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}
>
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-16 Thread Krishna Chaitanya
On Tue, Sep 3, 2019 at 5:23 PM Krishna Chaitanya
 wrote:
>
> On Tue, Aug 27, 2019 at 2:12 PM Krishna Chaitanya
>  wrote:
> >
> > On Mon, Aug 26, 2019 at 9:22 PM Bill Fenner  wrote:
> > >
> > > On Tue, Aug 20, 2019 at 8:45 AM Krishna Chaitanya 
> > >  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/net-snmp-coders@lists.sourceforge.net/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}


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-12 Thread Krishna Chaitanya
On Thu, Sep 12, 2019 at 6:59 PM Krishna Chaitanya
 wrote:
>
> On Wed, Sep 11, 2019 at 3:04 PM Niels Baggesen
>  wrote:
> >
> > On Wed, Sep 11, 2019 at 12:40:38PM +0530, Krishna Chaitanya wrote:
> > > > BTW, somehow the response from Neils is missed but found it in the 
> > > > archive.
> > > >
> > > > https://www.mail-archive.com/net-snmp-coders@lists.sourceforge.net/msg21705.html
> > > >
> > > > MacAddress TC from SNMPv2-TC is a fixed size string, so, the length
> > > > should not be prefixed.
> > > >
> > >
> > > Any ideas on how to get proper MAC address display without any side
> > > effects? Any help is appreciated.
> >
> > The MacAddress TC mentioned above has a DISPLAY-HINT "1x:", does that
> > not display the way you want? Otherwise show us what you see, and what
> > is wrong with it.
> >
> Missed your reply again, now added filters and then found it.
>
> Yes, the TC should work properly, but unfortunately, it doesn't, My
> display is as below:
> You can see that the "6" is prefixed and ".1/.2/.3" are part of MAC addresses.
>
> This may not be a display only problem, currently, I am debugging a case where
> deleting a single entry from the table makes it go haywire, it deletes
> the wrong entry,
> the same issue could probably be the reason (not sure though).

FYI, Just tried changing the MAC address the problem persists, so, this issue
is not the reason.
>
> $ snmptable -v3 -a MD5 -l authNoPriv localhost -OX -Ci
> index mpduTx
> ["wlp1s0"][6:52:54:0:c8:53].1302
> ["wlp1s0"][6:52:54:0:c8:53].2307
> ["wlp1s0"][6:52:54:0:c8:53].3328
>
>
> The MIB entry snippets are as below:
>
> MacAddress, TEXTUAL-CONVENTION FROM SNMPv2-TC
> ...
> bwtBh2GenStatsEntry OBJECT-TYPE
>   SYNTAX BwtBh2GenStatsEntry
>   MAX-ACCESS not-accessible
>   STATUS current
>   DESCRIPTION
> "A row in BH2 Gen stats table"
>   INDEX { ifaceName, remoteMAC }
>   ::= {bwtBh2GenStatsTable 1}
> 
> remoteMAC OBJECT-TYPE
>SYNTAX MacAddress
>MAX-ACCESS not-accessible
>STATUS current
>DESCRIPTION
>"Remote MAC address to which these statistics relate"
> ::= { bwtBh2GenStatsEntry 2 }



-- 
Thanks,
Regards,
Chaitanya T K.


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-12 Thread Krishna Chaitanya
On Wed, Sep 11, 2019 at 3:04 PM Niels Baggesen
 wrote:
>
> On Wed, Sep 11, 2019 at 12:40:38PM +0530, Krishna Chaitanya wrote:
> > > BTW, somehow the response from Neils is missed but found it in the 
> > > archive.
> > >
> > > https://www.mail-archive.com/net-snmp-coders@lists.sourceforge.net/msg21705.html
> > >
> > > MacAddress TC from SNMPv2-TC is a fixed size string, so, the length
> > > should not be prefixed.
> > >
> >
> > Any ideas on how to get proper MAC address display without any side
> > effects? Any help is appreciated.
>
> The MacAddress TC mentioned above has a DISPLAY-HINT "1x:", does that
> not display the way you want? Otherwise show us what you see, and what
> is wrong with it.
>
Missed your reply again, now added filters and then found it.

Yes, the TC should work properly, but unfortunately, it doesn't, My
display is as below:
You can see that the "6" is prefixed and ".1/.2/.3" are part of MAC addresses.

This may not be a display only problem, currently, I am debugging a case where
deleting a single entry from the table makes it go haywire, it deletes
the wrong entry,
the same issue could probably be the reason (not sure though).

$ snmptable -v3 -a MD5 -l authNoPriv localhost -OX -Ci
index mpduTx
["wlp1s0"][6:52:54:0:c8:53].1302
["wlp1s0"][6:52:54:0:c8:53].2307
["wlp1s0"][6:52:54:0:c8:53].3328


The MIB entry snippets are as below:

MacAddress, TEXTUAL-CONVENTION FROM SNMPv2-TC
...
bwtBh2GenStatsEntry OBJECT-TYPE
  SYNTAX BwtBh2GenStatsEntry
  MAX-ACCESS not-accessible
  STATUS current
  DESCRIPTION
"A row in BH2 Gen stats table"
  INDEX { ifaceName, remoteMAC }
  ::= {bwtBh2GenStatsTable 1}

remoteMAC OBJECT-TYPE
   SYNTAX MacAddress
   MAX-ACCESS not-accessible
   STATUS current
   DESCRIPTION
   "Remote MAC address to which these statistics relate"
::= { bwtBh2GenStatsEntry 2 }


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-11 Thread Niels Baggesen via Net-snmp-coders
On Wed, Sep 11, 2019 at 12:40:38PM +0530, Krishna Chaitanya wrote:
> > BTW, somehow the response from Neils is missed but found it in the archive.
> >
> > https://www.mail-archive.com/net-snmp-coders@lists.sourceforge.net/msg21705.html
> >
> > MacAddress TC from SNMPv2-TC is a fixed size string, so, the length
> > should not be prefixed.
> >
> 
> Any ideas on how to get proper MAC address display without any side
> effects? Any help is appreciated.

The MacAddress TC mentioned above has a DISPLAY-HINT "1x:", does that
not display the way you want? Otherwise show us what you see, and what
is wrong with it.

/Niels

-- 
Niels Baggesen - @home - Århus - Denmark - n...@users.sourceforge.net
The purpose of computing is insight, not numbers   ---   R W Hamming


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-11 Thread Krishna Chaitanya
On Tue, Sep 3, 2019, 5:23 PM Krishna Chaitanya 
wrote:

> On Tue, Aug 27, 2019 at 2:12 PM Krishna Chaitanya
>  wrote:
> >
> > On Mon, Aug 26, 2019 at 9:22 PM Bill Fenner  wrote:
> > >
> > > On Tue, Aug 20, 2019 at 8:45 AM Krishna Chaitanya <
> chaitanya.m...@gmail.com> 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/net-snmp-coders@lists.sourceforge.net/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
>
>
> BTW, somehow the response from Neils is missed but found it in the archive.
>
> https://www.mail-archive.com/net-snmp-coders@lists.sourceforge.net/msg21705.html
>
> MacAddress TC from SNMPv2-TC is a fixed size string, so, the length
> should not be prefixed.
>

Any ideas on how to get proper MAC address display without any side
effects? Any help is appreciated.

>
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-09-03 Thread Krishna Chaitanya
On Tue, Aug 27, 2019 at 2:12 PM Krishna Chaitanya
 wrote:
>
> On Mon, Aug 26, 2019 at 9:22 PM Bill Fenner  wrote:
> >
> > On Tue, Aug 20, 2019 at 8:45 AM Krishna Chaitanya 
> >  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/net-snmp-coders@lists.sourceforge.net/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


BTW, somehow the response from Neils is missed but found it in the archive.
https://www.mail-archive.com/net-snmp-coders@lists.sourceforge.net/msg21705.html

MacAddress TC from SNMPv2-TC is a fixed size string, so, the length
should not be prefixed.


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-08-27 Thread Krishna Chaitanya
On Mon, Aug 26, 2019 at 9:22 PM Bill Fenner  wrote:
>
> On Tue, Aug 20, 2019 at 8:45 AM Krishna Chaitanya  
> 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.


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-08-26 Thread Bill Fenner
On Tue, Aug 20, 2019 at 8:45 AM Krishna Chaitanya 
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.

  Bill
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-08-22 Thread Niels Baggesen via Net-snmp-coders
On Tue, Aug 20, 2019 at 06:14:34PM +0530, Krishna Chaitanya 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?

See RFC 2578, clause 7.7. You define your MAC address as an OCTET STRING
(SIZE(6)), then there is no need to prefix the length.

/Niels

-- 
Niels Baggesen - @home - Århus - Denmark - n...@users.sourceforge.net
The purpose of computing is insight, not numbers   ---   R W Hamming


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: MAC Address As Index

2019-08-20 Thread Krishna Chaitanya
On Tue, Aug 20, 2019 at 6:14 PM Krishna Chaitanya
 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?
>
Forgot to mention that the same question was asked way back in 2003
 and is still unanswered :-).

https://sourceforge.net/p/net-snmp/mailman/message/14894160/


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


MAC Address As Index

2019-08-20 Thread Krishna Chaitanya
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?

-- 
Thanks,
Regards,
Chaitanya T K.


___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Need clarification regarding Mac Address as Index

2010-02-08 Thread Dave Shield
On 8 February 2010 05:00, Sasikumar sasi_bku...@yahoo.co.in wrote:
    I am implementing Q-BRIDGE-MIB in this table is dot1qTpFdbTable
 which as dot1qTpFdbAddress as one of the Index.
 My question is when this table was queried the output contains
 length of the Mac address, Is this valid.

No.
You are quite correct.

MacAddress is a fixed-size type, so the string index value
should not include a length subidentifier.

Have a look at where the table indexing is registered.
This should be using ASN_PRIV_IMPLIED_OCTET_STR
rather than simply ASN_OCTET_STR

Dave

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Need clarification regarding Mac Address as Index

2010-02-07 Thread Sasikumar
Hi All,
   I am implementing Q-BRIDGE-MIB in this table is dot1qTpFdbTable which as 
dot1qTpFdbAddress as one of the Index.
My question is when this table was queried the output contains length of the 
Mac address, Is this valid. Since length is present if the index(string) whose 
length is variable.
If I am not wrong since the mac address length is defined as 6 I am assuming 
that length should not be sent to the manager correct me If my understanding is 
wrong.

.1.3.6.1.2.1.17.7.1.2.2.1.2.100.6.0.31.230.24.2.254 = INTEGER: 2
--- --- - -
   ||   ||  | ||
   \/   \/  \/\/
   dot1qTpFdbPort  vlan MacLen   Mac Address

Net-Snmp version used is 5.3.2.


Regards,
Sasikumar.B




  Your Mail works best with the New Yahoo Optimized IE8. Get it NOW! 
http://downloads.yahoo.com/in/internetexplorer/

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders