]> git.pld-linux.org Git - packages/net-snmp.git/commitdiff
- drop obsolete files
authorArkadiusz Miśkiewicz <arekm@maven.pl>
Sun, 5 Jul 2009 16:00:32 +0000 (16:00 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    net-snmp-64bit-error-checking.patch -> 1.3
    net-snmp-fix-64bit-interface-counters.patch -> 1.2
    net-snmp-snmpnetstat-getbulk.patch -> 1.6

net-snmp-64bit-error-checking.patch [deleted file]
net-snmp-fix-64bit-interface-counters.patch [deleted file]
net-snmp-snmpnetstat-getbulk.patch [deleted file]

diff --git a/net-snmp-64bit-error-checking.patch b/net-snmp-64bit-error-checking.patch
deleted file mode 100644 (file)
index 509384a..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-diff -ruN net-snmp-5.2.1.2.orig/snmplib/asn1.c net-snmp-5.2.1.2/snmplib/asn1.c
---- net-snmp-5.2.1.2.orig/snmplib/asn1.c       2004-12-10 15:07:16.000000000 +0000
-+++ net-snmp-5.2.1.2/snmplib/asn1.c    2007-02-17 23:54:03.000000000 +0000
-@@ -470,6 +470,13 @@
-     while (asn_length--)
-         value = (value << 8) | *bufp++;
-+/*#if SIZEOF_LONG != 4
-+    if ((unsigned long)value > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating integer value to 32 bits\n");
-+        value &= 0xffffffff;
-+    }
-+#endif*/
-+
-     DEBUGMSG(("dumpv_recv", "  Integer:\t%ld (0x%.2X)\n", value, value));
-     *intp = value;
-@@ -535,6 +542,13 @@
-     while (asn_length--)
-         value = (value << 8) | *bufp++;
-+#if SIZEOF_LONG != 4
-+    if (value > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating uinteger value to 32 bits\n");
-+        value &= 0xffffffff;
-+    }
-+#endif
-+
-     DEBUGMSG(("dumpv_recv", "  UInteger:\t%ld (0x%.2X)\n", value, value));
-     *intp = value;
-@@ -584,6 +598,12 @@
-         return NULL;
-     }
-     integer = *intp;
-+#if SIZEOF_LONG != 4
-+    if ((unsigned long)integer > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating integer value to 32 bits\n");
-+        integer &= 0xffffffff;
-+    }
-+#endif
-     /*
-      * Truncate "unnecessary" bytes off of the most significant end of this
-      * 2's complement integer.  There should be no sequence of 9
-@@ -663,6 +683,12 @@
-         return NULL;
-     }
-     integer = *intp;
-+#if SIZEOF_LONG != 4
-+    if (integer > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating uinteger value to 32 bits\n");
-+        integer &= 0xffffffff;
-+    }
-+#endif
-     mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1));
-     /*
-      * mask is 0xFF000000 on a big-endian machine 
-@@ -1286,18 +1312,13 @@
-                 (subidentifier << 7) + (*(u_char *) bufp & ~ASN_BIT8);
-             length--;
-         } while (*(u_char *) bufp++ & ASN_BIT8);        /* last byte has high bit clear */
--        /*
--         * ?? note, this test will never be true, since the largest value
--         * of subidentifier is the value of MAX_SUBID! 
--         *
--         * Yes: PC-LINT says the same thing
--         * No!: the agent can be configured to use a char instead of a long
--         *      for OIDs, in which case this test is essential.
--         */
-+
-+#if defined(EIGHTBIT_SUBIDS) || (SIZEOF_LONG != 4)
-         if (subidentifier > (u_long) MAX_SUBID) {
-             ERROR_MSG("subidentifier too large");
-             return NULL;
-         }
-+#endif
-         *oidp++ = (oid) subidentifier;
-     }
-@@ -1439,6 +1460,12 @@
-         if (i >= (int) objidlength)
-             break;
-         objid_val = *op++;    /* XXX - doesn't handle 2.X (X > 40) */
-+#if SIZEOF_LONG != 4
-+        if (objid_val > 0xffffffff) {
-+            snmp_log(LOG_ERR,"truncating objid value to 32 bits\n");
-+            objid_val &= 0xffffffff;
-+        }
-+#endif
-     }
-     /*
-@@ -1454,8 +1481,13 @@
-      */
-     for (i = 1, objid_val = first_objid_val, op = objid + 2;
-          i < (int) objidlength; i++) {
--        if (i != 1)
-+        if (i != 1) {
-             objid_val = *op++;
-+#if SIZEOF_LONG != 4
-+            if (objid_val > 0xffffffff) /* already logged warning above */
-+                objid_val &= 0xffffffff;
-+#endif
-+        }
-         switch (objid_size[i]) {
-         case 1:
-             *data++ = (u_char) objid_val;
-@@ -1783,6 +1815,17 @@
-         low = (low << 8) | *bufp++;
-     }
-+#if SIZEOF_LONG != 4
-+    if (high > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 high value to 32 bits\n");
-+        high &= 0xffffffff;
-+    }
-+    if (low > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 low value to 32 bits\n");
-+        low &= 0xffffffff;
-+    }
-+#endif
-+
-     cp->low = low;
-     cp->high = high;
-@@ -1843,6 +1886,16 @@
-     intsize = 8;
-     low = cp->low;
-     high = cp->high;
-+#if SIZEOF_LONG != 4
-+    if (high > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 high value to 32 bits\n");
-+        high &= 0xffffffff;
-+    }
-+    if (low > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 low value to 32 bits\n");
-+        low &= 0xffffffff;
-+    }
-+#endif
-     mask = ((u_long) 0xFF) << (8 * (sizeof(long) - 1));
-     /*
-      * mask is 0xFF000000 on a big-endian machine 
-@@ -2041,6 +2094,17 @@
-         low = (low << 8) | *bufp++;
-     }
-+#if SIZEOF_LONG != 4
-+    if (high > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 high value to 32 bits\n");
-+        high &= 0xffffffff;
-+    }
-+    if (low > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 low value to 32 bits\n");
-+        low &= 0xffffffff;
-+    }
-+#endif
-+
-     cp->low = low;
-     cp->high = high;
-@@ -2103,6 +2167,16 @@
-     memcpy(&c64, cp, sizeof(struct counter64)); /* we're may modify it */
-     low = c64.low;
-     high = c64.high;
-+#if SIZEOF_LONG != 4
-+    if (high > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 high value to 32 bits\n");
-+        high &= 0xffffffff;
-+    }
-+    if (low > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 low value to 32 bits\n");
-+        low &= 0xffffffff;
-+    }
-+#endif
-     /*
-      * Truncate "unnecessary" bytes off of the most significant end of this
-@@ -2673,6 +2747,12 @@
-         _asn_size_err(errpre, intsize, sizeof(long));
-         return 0;
-     }
-+#if SIZEOF_LONG != 4
-+    if ((unsigned long)integer > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating integer value to 32 bits\n");
-+        integer &= 0xffffffff;
-+    }
-+#endif
-     if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
-         return 0;
-@@ -2825,6 +2905,13 @@
-         return 0;
-     }
-+#if SIZEOF_LONG != 4
-+    if (integer > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating uinteger value to 32 bits\n");
-+        integer &= 0xffffffff;
-+    }
-+#endif
-+
-     if (((*pkt_len - *offset) < 1) && !(r && asn_realloc(pkt, pkt_len))) {
-         return 0;
-     }
-@@ -2960,6 +3047,12 @@
-     } else {
-         for (i = objidlength; i > 2; i--) {
-             tmpint = objid[i - 1];
-+#if SIZEOF_LONG != 4
-+            if ((unsigned long)tmpint > 0xffffffff) {
-+                snmp_log(LOG_ERR,"truncating oid subid to 32 bits\n");
-+                tmpint &= 0xffffffff;
-+            }
-+#endif
-             if (((*pkt_len - *offset) < 1)
-                 && !(r && asn_realloc(pkt, pkt_len))) {
-@@ -3176,6 +3269,16 @@
-                       sizeof(struct counter64));
-         return 0;
-     }
-+#if SIZEOF_LONG != 4
-+    if (high > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 high value to 32 bits\n");
-+        high &= 0xffffffff;
-+    }
-+    if (low > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 low value to 32 bits\n");
-+        low &= 0xffffffff;
-+    }
-+#endif
-     /*
-      * Encode the low 4 bytes first.  
-@@ -3359,6 +3462,17 @@
-         return 0;
-     }
-+#if SIZEOF_LONG != 4
-+    if (high > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 high value to 32 bits\n");
-+        high &= 0xffffffff;
-+    }
-+    if (low > 0xffffffff) {
-+        snmp_log(LOG_ERR,"truncating counter64 low value to 32 bits\n");
-+        low &= 0xffffffff;
-+    }
-+#endif
-+
-     /*
-      * Encode the low 4 bytes first.  
-      */
-diff -ruN net-snmp-5.2.1.2.orig/snmplib/int64.c net-snmp-5.2.1.2/snmplib/int64.c
---- net-snmp-5.2.1.2.orig/snmplib/int64.c      2004-07-11 04:28:45.000000000 +0000
-+++ net-snmp-5.2.1.2/snmplib/int64.c   2007-02-17 23:54:03.000000000 +0000
-@@ -179,7 +179,9 @@
-      */
-     pu64->low = (ulT1 + u16) & 0x0FFFFFFFFL;
-     pu64->high++;
--
-+#if SIZEOF_LONG != 4
-+    pu64->high &= 0xffffffff;
-+#endif
- }                               /* incrByV16 */
- void
-@@ -188,8 +190,15 @@
-     unsigned int    tmp;
-     tmp = pu64->low;
-     pu64->low += u32;
--    if (pu64->low < tmp)
-+#if SIZEOF_LONG != 4
-+    pu64->low &= 0xffffffff;
-+#endif
-+    if (pu64->low < tmp) {
-         pu64->high++;
-+#if SIZEOF_LONG != 4
-+        pu64->high &= 0xffffffff;
-+#endif
-+    }
- }
- /**
-@@ -214,6 +223,9 @@
- u64Incr(U64 * pu64out, const U64 * pu64one)
- {
-     pu64out->high += pu64one->high;
-+#if SIZEOF_LONG != 4
-+    pu64out->high &= 0xffffffff;
-+#endif
-     incrByU32(pu64out, pu64one->low);
- }
-@@ -247,7 +259,6 @@
- void
- zeroU64(U64 * pu64)
- {
--
-     pu64->low = 0;
-     pu64->high = 0;
- }                               /* zeroU64 */
-@@ -315,8 +326,12 @@
-      */
-     if (new_val->high == old_val->high) {
-         DEBUGMSGTL(("c64:check_wrap", "32 bit wrap\n"));
--        if (adjust)
-+        if (adjust) {
-             ++new_val->high;
-+#if SIZEOF_LONG != 4
-+            new_val->high &= 0xffffffff;
-+#endif
-+        }
-         return 32;
-     }
-     else if ((new_val->high == (old_val->high + 1)) ||
-diff -ruN net-snmp-5.2.1.2.orig/snmplib/snmp_client.c net-snmp-5.2.1.2/snmplib/snmp_client.c
---- net-snmp-5.2.1.2.orig/snmplib/snmp_client.c        2004-12-10 02:21:38.000000000 +0000
-+++ net-snmp-5.2.1.2/snmplib/snmp_client.c     2007-02-17 23:54:43.000000000 +0000
-@@ -94,6 +94,7 @@
- #include <net-snmp/library/snmp_api.h>
- #include <net-snmp/library/snmp_client.h>
-+#include <net-snmp/library/snmp_logging.h>
- #include <net-snmp/library/snmp_secmod.h>
- #include <net-snmp/library/mib.h>
-@@ -714,41 +715,193 @@
-  */
- int
--snmp_set_var_value(netsnmp_variable_list * newvar,
--                   const u_char * val_str, size_t val_len)
-+snmp_set_var_value(netsnmp_variable_list * vars,
-+                   const u_char * value, size_t len)
- {
-+    int             largeval = 1;
-+
-     /*
-      * xxx-rks: why the unconditional free? why not use existing
--     * memory, if val_len < newvar->val_len ?
-+     * memory, if len < vars->val_len ?
-      */
--    if (newvar->val.string && newvar->val.string != newvar->buf) {
--        free(newvar->val.string);
-+    if (vars->val.string && vars->val.string != vars->buf) {
-+        free(vars->val.string);
-     }
--
--    newvar->val.string = 0;
--    newvar->val_len = 0;
-+    vars->val.string = 0;
-+    vars->val_len = 0;
-     /*
--     * need a pointer and a length to copy a string value. 
-+     * use built-in storage for smaller values 
-      */
--    if (val_str && val_len) {
--        if (val_len <= sizeof(newvar->buf))
--            newvar->val.string = newvar->buf;
--        else {
--            newvar->val.string = (u_char *) malloc(val_len);
--            if (!newvar->val.string)
--                return 1;
--        }
--        memmove(newvar->val.string, val_str, val_len);
--        newvar->val_len = val_len;
--    } else if (val_str) {
-+    if (len <= (sizeof(vars->buf) - 1)) {
-+        vars->val.string = (u_char *) vars->buf;
-+        largeval = 0;
-+    }
-+
-+    if ((0 == len) || (NULL == value)) {
-+        vars->val.string[0] = 0;
-+        return 0;
-+    }
-+
-+    vars->val_len = len;
-+    switch (vars->type) {
-+    case ASN_INTEGER:
-+    case ASN_UNSIGNED:
-+    case ASN_TIMETICKS:
-+    case ASN_IPADDRESS:
-+    case ASN_COUNTER:
-+        if (value) {
-+            if (vars->val_len == sizeof(int)) {
-+                if (ASN_INTEGER == vars->type) {
-+                    const int      *val_int 
-+                        = (const int *) value;
-+                    *(vars->val.integer) = (long) *val_int;
-+                } else {
-+                    const u_int    *val_uint
-+                        = (const u_int *) value;
-+                    *(vars->val.integer) = (unsigned long) *val_uint;
-+                }
-+            }
-+#if SIZEOF_LONG != SIZEOF_INT
-+            else if (vars->val_len == sizeof(long)){
-+                const u_long   *val_ulong
-+                    = (const u_long *) value;
-+                *(vars->val.integer) = *val_ulong;
-+                if (*(vars->val.integer) > 0xffffffff) {
-+                    snmp_log(LOG_ERR,"truncating integer value > 32 bits\n");
-+                    *(vars->val.integer) &= 0xffffffff;
-+                }
-+            }
-+#endif
-+#if SIZEOF_LONG != SIZEOF_LONG_LONG
-+            else if (vars->val_len == sizeof(long long)){
-+                const unsigned long long   *val_ullong
-+                    = (const unsigned long long *) value;
-+                *(vars->val.integer) = (long) *val_ullong;
-+                if (*(vars->val.integer) > 0xffffffff) {
-+                    snmp_log(LOG_ERR,"truncating integer value > 32 bits\n");
-+                    *(vars->val.integer) &= 0xffffffff;
-+                }
-+            }
-+#endif
-+#if SIZEOF_SHORT != SIZEOF_INT
-+            else if (vars->val_len == sizeof(short)) {
-+                if (ASN_INTEGER == vars->type) {
-+                    const short      *val_short 
-+                        = (const short *) value;
-+                    *(vars->val.integer) = (long) *val_short;
-+                } else {
-+                    const u_short    *val_ushort
-+                        = (const u_short *) value;
-+                    *(vars->val.integer) = (unsigned long) *val_ushort;
-+                }
-+            }
-+#endif
-+            else if (vars->val_len == sizeof(char)) {
-+                if (ASN_INTEGER == vars->type) {
-+                    const char      *val_char 
-+                        = (const char *) value;
-+                    *(vars->val.integer) = (long) *val_char;
-+                } else {
-+                    *(vars->val.integer) = (unsigned long) *value;
-+                }
-+            }
-+            else {
-+                snmp_log(LOG_ERR,"bad size for integer-like type (%d)\n",
-+                         vars->val_len);
-+                return (1);
-+            }
-+        } else
-+            *(vars->val.integer) = 0;
-+        vars->val_len = sizeof(long);
-+        break;
-+
-+    case ASN_OBJECT_ID:
-+    case ASN_PRIV_IMPLIED_OBJECT_ID:
-+    case ASN_PRIV_INCL_RANGE:
-+    case ASN_PRIV_EXCL_RANGE:
-+        if (largeval) {
-+            vars->val.objid = (oid *) malloc(vars->val_len);
-+        }
-+        if (vars->val.objid == NULL) {
-+            snmp_log(LOG_ERR,"no storage for OID\n");
-+            return 1;
-+        }
-+        memmove(vars->val.objid, value, vars->val_len);
-+        break;
-+
-+    case ASN_PRIV_IMPLIED_OCTET_STR:
-+    case ASN_OCTET_STR:
-+    case ASN_BIT_STR:
-+    case ASN_OPAQUE:
-+    case ASN_NSAP:
-+        if (largeval) {
-+            vars->val.string = (u_char *) malloc(vars->val_len + 1);
-+        }
-+        if (vars->val.string == NULL) {
-+            snmp_log(LOG_ERR,"no storage for OID\n");
-+            return 1;
-+        }
-+        memmove(vars->val.string, value, vars->val_len);
-         /*
--         * NULL STRING != NULL ptr 
-+         * Make sure the string is zero-terminated; some bits of code make
-+         * this assumption.  Easier to do this here than fix all these wrong
-+         * assumptions.  
-          */
--        newvar->val.string = newvar->buf;
--        newvar->val.string[0] = '\0';
--        newvar->val_len = 0;
-+        vars->val.string[vars->val_len] = '\0';
-+        break;
-+
-+    case SNMP_NOSUCHOBJECT:
-+    case SNMP_NOSUCHINSTANCE:
-+    case SNMP_ENDOFMIBVIEW:
-+    case ASN_NULL:
-+        vars->val_len = 0;
-+        vars->val.string = NULL;
-+        break;
-+
-+#ifdef OPAQUE_SPECIAL_TYPES
-+    case ASN_OPAQUE_U64:
-+    case ASN_OPAQUE_I64:
-+#endif                          /* OPAQUE_SPECIAL_TYPES */
-+    case ASN_COUNTER64:
-+        if (largeval) {
-+            snmp_log(LOG_ERR,"bad size for counter 64 (%d)\n",
-+                     vars->val_len);
-+            return (1);
-+        }
-+        vars->val_len = sizeof(struct counter64);
-+        memmove(vars->val.counter64, value, vars->val_len);
-+        break;
-+
-+#ifdef OPAQUE_SPECIAL_TYPES
-+    case ASN_OPAQUE_FLOAT:
-+        if (largeval) {
-+            snmp_log(LOG_ERR,"bad size for opaque float (%d)\n",
-+                     vars->val_len);
-+            return (1);
-+        }
-+        vars->val_len = sizeof(float);
-+        memmove(vars->val.floatVal, value, vars->val_len);
-+        break;
-+
-+    case ASN_OPAQUE_DOUBLE:
-+        if (largeval) {
-+            snmp_log(LOG_ERR,"bad size for opaque double (%d)\n",
-+                     vars->val_len);
-+            return (1);
-+        }
-+        vars->val_len = sizeof(double);
-+        memmove(vars->val.doubleVal, value, vars->val_len);
-+        break;
-+
-+#endif                          /* OPAQUE_SPECIAL_TYPES */
-+
-+    default:
-+        snmp_log(LOG_ERR,"no storage for OID\n");
-+        snmp_set_detail("Internal error in type switching\n");
-+        return (1);
-     }
-+
-     return 0;
- }
diff --git a/net-snmp-fix-64bit-interface-counters.patch b/net-snmp-fix-64bit-interface-counters.patch
deleted file mode 100644 (file)
index 18515d4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -u -p -r5.33 interfaces.c
---- agent/mibgroup/mibII/interfaces.c   9 May 2005 20:06:02 -0000       5.33
-+++ agent/mibgroup/mibII/interfaces.c   9 Jun 2005 20:08:04 -0000
-@@ -1552,19 +1552,19 @@ Interface_Scan_Init(void)
-         if (!strcmp(ifname_buf, "lo") && rec_pkt > 0 && !snd_pkt)
-             snd_pkt = rec_pkt;
-
--        nnew->if_ipackets = rec_pkt;
-+        nnew->if_ipackets = rec_pkt & 0xffffffff;
-         nnew->if_ierrors = rec_err;
--        nnew->if_opackets = snd_pkt;
-+        nnew->if_opackets = snd_pkt & 0xffffffff;
-         nnew->if_oerrors = snd_err;
-         nnew->if_collisions = coll;
-         if (scan_line_to_use == scan_line_2_2) {
--            nnew->if_ibytes = rec_oct;
--            nnew->if_obytes = snd_oct;
-+            nnew->if_ibytes = rec_oct & 0xffffffff;
-+            nnew->if_obytes = snd_oct & 0xffffffff;
-             nnew->if_iqdrops = rec_drop;
-             nnew->if_snd.ifq_drops = snd_drop;
-         } else {
--            nnew->if_ibytes = rec_pkt * 308;
--            nnew->if_obytes = snd_pkt * 308;
-+            nnew->if_ibytes = (rec_pkt * 308) & 0xffffffff;
-+            nnew->if_obytes = (snd_pkt * 308) & 0xffffffff;
-         }
-
-         /*
diff --git a/net-snmp-snmpnetstat-getbulk.patch b/net-snmp-snmpnetstat-getbulk.patch
deleted file mode 100644 (file)
index fdb44f5..0000000
+++ /dev/null
@@ -1,310 +0,0 @@
---- net-snmp-5.4.2.1-dev/apps/snmpnetstat/inet.c       2009-01-22 18:26:23.264301468 +0200
-+++ net-snmp-5.4.2.1-dev/apps/snmpnetstat/inet.c       2009-01-22 18:48:30.400620330 +0200
-@@ -106,20 +106,65 @@
- };
- #define TCP_NSTATES 11
--void
--tcpprotopr(const char *name)
-+static void
-+tcpprotoprint_line(const char *name, netsnmp_variable_list *vp, int *first)
- {
--    netsnmp_variable_list *var, *vp;
--    oid    tcpConnState_oid[] = { 1,3,6,1,2,1,6,13,1,1 };
--    size_t tcpConnState_len   = OID_LENGTH( tcpConnState_oid );
-     int    state, width;
-+    char  *cp;
-     union {
-         struct in_addr addr;
-         char      data[4];
-     } tmpAddr;
-     oid    localPort, remotePort;
-     struct in_addr localAddr, remoteAddr;
--    char  *cp;
-+
-+      state = *vp->val.integer;
-+      if (!aflag && state == MIB_TCPCONNSTATE_LISTEN) {
-+              return;
-+      }
-+
-+      if (*first) {
-+              printf("Active Internet (%s) Connections", name);
-+              if (aflag)
-+                      printf(" (including servers)");
-+              putchar('\n');
-+              width = Aflag ? 18 : 22;
-+              printf("%-5.5s %*.*s %*.*s %s\n",
-+                         "Proto", -width, width, "Local Address",
-+                                              -width, width, "Remote Address", "(state)");
-+              *first = 0;
-+      }
-+      
-+      /* Extract the local/remote information from the index values */
-+      cp = tmpAddr.data;
-+      cp[0] = vp->name[ 10 ] & 0xff;
-+      cp[1] = vp->name[ 11 ] & 0xff;
-+      cp[2] = vp->name[ 12 ] & 0xff;
-+      cp[3] = vp->name[ 13 ] & 0xff;
-+      localAddr.s_addr = tmpAddr.addr.s_addr;
-+      localPort        = ntohs(vp->name[ 14 ]);
-+      cp = tmpAddr.data;
-+      cp[0] = vp->name[ 15 ] & 0xff;
-+      cp[1] = vp->name[ 16 ] & 0xff;
-+      cp[2] = vp->name[ 17 ] & 0xff;
-+      cp[3] = vp->name[ 18 ] & 0xff;
-+      remoteAddr.s_addr = tmpAddr.addr.s_addr;
-+      remotePort        = ntohs(vp->name[ 19 ]);
-+
-+      printf("%-5.5s", name);
-+      inetprint(&localAddr,  localPort,  name, 1);
-+      inetprint(&remoteAddr, remotePort, name, 0);
-+      if (state < 1 || state > TCP_NSTATES) {
-+              printf("%d\n", state );
-+      } else {
-+              printf("%s\n", tcpstates[state]);
-+      }
-+}
-+
-+static void
-+tcpprotopr_get(const char *name, oid *root, size_t root_len)
-+{
-+    netsnmp_variable_list *var, *vp;
-     int    first = 1;
-     /*
-@@ -127,7 +172,7 @@
-      *   the necessary information.
-      */
-     var = NULL;
--    snmp_varlist_add_variable( &var, tcpConnState_oid, tcpConnState_len,
-+    snmp_varlist_add_variable( &var, root, root_len,
-                                    ASN_NULL, NULL,  0);
-     if (!var)
-         return;
-@@ -137,45 +182,111 @@
-     for (vp = var; vp ; vp=vp->next_variable) {
--        state = *vp->val.integer;
--        if (!aflag && state == MIB_TCPCONNSTATE_LISTEN)
--            continue;
--
--        if (first) {
--            printf("Active Internet (%s) Connections", name);
--            if (aflag)
--                printf(" (including servers)");
--            putchar('\n');
--            width = Aflag ? 18 : 22;
--            printf("%-5.5s %*.*s %*.*s %s\n",
--                   "Proto", -width, width, "Local Address",
--                            -width, width, "Remote Address", "(state)");
--            first=0;
--        }
--        
--        /* Extract the local/remote information from the index values */
--        cp = tmpAddr.data;
--        cp[0] = vp->name[ 10 ] & 0xff;
--        cp[1] = vp->name[ 11 ] & 0xff;
--        cp[2] = vp->name[ 12 ] & 0xff;
--        cp[3] = vp->name[ 13 ] & 0xff;
--        localAddr.s_addr = tmpAddr.addr.s_addr;
--        localPort        = ntohs(vp->name[ 14 ]);
--        cp = tmpAddr.data;
--        cp[0] = vp->name[ 15 ] & 0xff;
--        cp[1] = vp->name[ 16 ] & 0xff;
--        cp[2] = vp->name[ 17 ] & 0xff;
--        cp[3] = vp->name[ 18 ] & 0xff;
--        remoteAddr.s_addr = tmpAddr.addr.s_addr;
--        remotePort        = ntohs(vp->name[ 19 ]);
--
--        printf("%-5.5s", name);
--        inetprint(&localAddr,  localPort,  name, 1);
--        inetprint(&remoteAddr, remotePort, name, 0);
--        if ( state < 1 || state > TCP_NSTATES )
--            printf("%d\n", state );
--        else
--            printf("%s\n", tcpstates[ state ]);
-+              tcpprotoprint_line(name, vp, &first);
-     }
-     snmp_free_varbind( var );
- }
-+void
-+tcpprotopr_bulkget(const char *name, oid *root, size_t root_len)
-+{
-+    netsnmp_variable_list *vp;
-+      netsnmp_pdu    *pdu, *response;
-+    oid             tcpConnState_oid[MAX_OID_LEN];
-+      size_t          tcpConnState_len;
-+    int    first = 1;
-+    int    running = 1;
-+    int    status;
-+
-+      /*
-+     * setup initial object name
-+     */
-+      memmove(tcpConnState_oid, root, sizeof(root) * root_len);
-+      tcpConnState_len = root_len;
-+
-+    /*
-+     * Walking the tcpConnState column will provide all
-+     *   the necessary information.
-+     */
-+      while (running) {
-+        /*
-+         * create PDU for GETBULK request and add object name to request
-+         */
-+        pdu = snmp_pdu_create(SNMP_MSG_GETBULK);
-+        pdu->non_repeaters = 0;
-+        pdu->max_repetitions = max_getbulk;    /* fill the packet */
-+        snmp_add_null_var(pdu, tcpConnState_oid, tcpConnState_len);
-+
-+        /*
-+         * do the request
-+         */
-+        status = snmp_synch_response(ss, pdu, &response);
-+        if (status == STAT_SUCCESS) {
-+            if (response->errstat == SNMP_ERR_NOERROR) {
-+                              for (vp = response->variables; vp ; vp=vp->next_variable) {
-+                    if ((vp->name_length < root_len) ||
-+                                                      (memcmp(root, vp->name, sizeof(oid) * root_len) != 0)) {
-+                        /*
-+                         * not part of this subtree
-+                         */
-+                        running = 0;
-+                        continue;
-+                    }
-+
-+                                      tcpprotoprint_line(name, vp, &first);
-+
-+                    if ((vp->type != SNMP_ENDOFMIBVIEW) &&
-+                        (vp->type != SNMP_NOSUCHOBJECT) &&
-+                        (vp->type != SNMP_NOSUCHINSTANCE)) {
-+                        /*
-+                         * Check if last variable, and if so, save for next request.
-+                         */
-+                        if (vp->next_variable == NULL) {
-+                            memmove(tcpConnState_oid, vp->name,
-+                                    vp->name_length * sizeof(oid));
-+                            tcpConnState_len = vp->name_length;
-+                        }
-+                    } else {
-+                        /*
-+                         * an exception value, so stop
-+                         */
-+                        running = 0;
-+                    }
-+                              }
-+            } else {
-+                /*
-+                 * error in response, print it
-+                 */
-+                running = 0;
-+            }
-+        } else if (status == STAT_TIMEOUT) {
-+            running = 0;
-+        } else {                /* status == STAT_ERROR */
-+            running = 0;
-+        }
-+
-+        if (response) {
-+            snmp_free_pdu(response);
-+              }
-+      }
-+}
-+
-+void
-+tcpprotopr(const char *name)
-+{
-+    oid    tcpConnState_oid[] = { 1,3,6,1,2,1,6,13,1,1 };
-+    size_t tcpConnState_len   = OID_LENGTH( tcpConnState_oid );
-+      int    use_getbulk = 1;
-+
-+#ifndef NETSNMP_DISABLE_SNMPV1
-+    if (ss->version == SNMP_VERSION_1) {
-+        use_getbulk = 0;
-+      }
-+#endif
-+
-+      if (use_getbulk) {
-+              tcpprotopr_bulkget(name, tcpConnState_oid, tcpConnState_len);
-+      } else {
-+              tcpprotopr_get(name, tcpConnState_oid, tcpConnState_len);
-+      }
-+}
-+
- /*
---- net-snmp-5.4.2.1/man/snmpnetstat.1.def     2009-01-22 18:43:30.073986008 +0200
-+++ net-snmp-5.4.2.1-dev/man/snmpnetstat.1.def 2009-01-22 18:57:34.170565184 +0200
-@@ -92,6 +92,12 @@
- traffic on the configured network interfaces.
- The fourth form displays statistics about the named protocol.
- .PP
-+.B snmpnetstat
-+will issue GETBULK requests to query for information
-+if at least protocol version
-+.I v2
-+is used.
-+.PP
- AGENT identifies a target SNMP agent, which is
- instrumented to monitor the given objects.
- At its simplest, the AGENT specification will
-@@ -164,6 +170,11 @@
- is also present, show per-protocol routing statistics instead of 
- the routing tables.
- .PP
-+.BI \-CR " repeaters"
-+For GETBULK requests,
-+.I repeaters
-+specifies the max-repeaters value to use.
-+.PP
- When  snmpnetstat is invoked with an interval argument, it
- displays a running count of statistics related to  network
- interfaces.
---- net-snmp-5.4.2.1/apps/snmpnetstat/main.c   2006-09-15 03:48:50.000000000 +0300
-+++ net-snmp-5.4.2.1-dev/apps/snmpnetstat/main.c       2009-01-22 18:48:17.313950236 +0200
-@@ -75,9 +75,11 @@
- int   tflag;          /* show i/f watchdog timers */
- int   vflag;          /* be verbose */
-+
- int   interval;       /* repeat interval for i/f stats */
- char  *intrface;      /* desired i/f for stats, or NULL for all i/fs */
- int   af;             /* address family */
-+int     max_getbulk = 32;  /* specifies the max-repeaters value to use with GETBULK requests */
- char    *progname = NULL;
-@@ -231,6 +233,24 @@
-               case 'r':
-                       rflag = 1;
-                       break;
-+              case 'R':
-+                        if (optind < argc) {
-+                            if (argv[optind]) {
-+                                max_getbulk = atoi(argv[optind]);
-+                                if (max_getbulk == 0) {
-+                                    usage();
-+                                    fprintf(stderr, "Bad -CR option: %s\n", 
-+                                            argv[optind]);
-+                                    exit(1);
-+                                }
-+                            }
-+                        } else {
-+                            usage();
-+                            fprintf(stderr, "Bad -CR option: no argument given\n");
-+                            exit(1);
-+                        }
-+                        optind++;
-+                        break;
-               case 'S':            /* FreeBSD:
-                                       NetBSD:  Semi-numeric display
-                                       OpenBSD: Show route source selector */
---- net-snmp-5.4.2.1/apps/snmpnetstat/netstat.h~       2009-01-22 19:09:36.000000000 +0200
-+++ net-snmp-5.4.2.1/apps/snmpnetstat/netstat.h        2009-01-22 19:09:38.270836446 +0200
-@@ -62,6 +62,7 @@
- extern char   *intrface;      /* desired i/f for stats, or NULL for all i/fs */
- extern int    af;             /* address family */
-+extern int  max_getbulk;  /* specifies the max-repeaters value to use with GETBULK requests */
- extern        char *__progname; /* program name, from crt0.o */
This page took 0.05853 seconds and 4 git commands to generate.