On Thu, Oct 2, 2014 at 12:34 PM, Bill Weng <weng.b...@gmail.com> wrote:

> Hi,
>
> I am trying to snmpget on an object of "Ipv6Address" type from our
> application. The response got it from agent look like this, 
> 300200000000000000000000ac123803,
> a 16-byte octet string.
>

Are you positive that this is a 16-byte octet string?  It's a common agent
bug to return an ASCII printable string, e.g., a 32-byte octet string that
actually contains the bytes 3330303230303030....

One way to tell is to run your snmpget with -Ddump.  Look at the
"dumpx_recv" output for the actual bytes of the response.

But the final display shows in ascii string of every char, separated by
> colon in the group of 2,  3330:3032:3030:3030:3030:3030:3030:3030:
> 3030:3030:3030:3030:6163:3132:3338:3033. I expect this
> 3002:0000:0000:0000:0000:0000:ac12:3803. What can be wrong? With the
> limitation of my application can send only string data in response, what
> can be done to correct this ipv6 address display problem?
>

I am not sure what you mean by "string data" - if you mean that your agent
can only send the ASCII representation of the value, then you have to
change the MIB so that it doesn't claim that the value is an Ipv6Address.

  Bill



> Thanks for the help.
> Bill
>
>
> Excerpt  of sprint_realloc_octet_string function from snmplib/mib.c
> (5.7.2.1 net-snmp). (Line 489 - 496 block was added to make sure what agent
> response).
>
>     479
>     480
>     481     if (hint) {
>     482         int             repeat, width = 1;
>     483         long            value;
>     484         char            code = 'd', separ = 0, term = 0, ch,
> intbuf[32];
>     485 #define HEX2DIGIT_NEED_INIT 3
>     486         char            hex2digit = HEX2DIGIT_NEED_INIT;
>     487         u_char         *ecp;
>     488
>     489         int count=1;
>     490         if (var->type == ASN_OCTET_STR ) {
>     491            char *sp = malloc(1 + var->val_len);
>     492            memcpy(sp, var->val.string, var->val_len);
>     493            sp[var->val_len] = '\0';
>     494            printf(" my value %d is a string: %s\n", count, sp);
>     495         } else
>     496            printf(" value is NOT a strng\n");
>     497
>     498         if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
> NETSNMP_DS_LIB_QUICK_PRINT)) {
>     499             if (!snmp_cstrcat(buf, buf_len, out_len,
> allow_realloc, "STRING: ")) {
>     500                 return 0;
>     501             }
>     502         }
>     503         cp = var->val.string;
>     504         ecp = cp + var->val_len;
>     505
>     506         while (cp < ecp) {
>     507             repeat = 1;
>     508             if (*hint) {
>
> Sample run of snmpget:
> [root@4GPMSGW net-snmp-5.7.2.1]# ./apps/snmpget -v3 -u FMS -n FMS -m
> /opt/conf/FGW.mib 127.0.0.1 FGW-MIB::henbmastercpIpAddressHeNBCpLocal2V6.1
>  my value 1 is a string: 300200000000000000000000ac123803
> FGW-MIB::henbmastercpIpAddressHeNBCpLocal2V6.1 = STRING:
> 3330:3032:3030:3030:3030:3030:3030:3030:3030:3030:3030:3030:6163:3132:3338:3033
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> Net-snmp-users mailing list
> Net-snmp-users@lists.sourceforge.net
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
>
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to