pass_persist counter32

Michael Wu <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CAKA5oyYGZaS_1fwbeqn7oRS1CO_3KV2Pe2LbimsugS_1ZG0YmQ@mail.gmail.com>
Hi All,

The counter32 value returned from pass_persist script never wraps around on
my system (debian ppc) it remains at 2^32-1 with counter value more than
2^32-1.
In netsnmp_internal_pass_parse() in pass_common.c

    else if (!strncasecmp(buf, "counter", 7)) {
        *var_len = sizeof(long_ret);
        long_ret = strtoul(buf2, NULL, 10);
        vp->type = ASN_COUNTER;
        return ((unsigned char *) &long_ret);

It calls strtoul to convert the value string to long (long is 4 bytes
on my system) so anything more than 2^32-1 will be -1. Should the wrap
around logic happen here? I could use counter64 but just curious if my
understanding is correct.

Appreciate your help,


Michael

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
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.