1
commit a1fd64716f6794c55c34d77e618210238a73bfa1
2
Author: Wes Hardaker <hardaker@users.sourceforge.net>
3
Date: Wed Feb 19 15:21:57 2014 -0800
5
bug fix from fenner: fix ICMP mib table handling on linux
7
Index: net-snmp-5.7.2~dfsg/agent/mibgroup/mibII/icmp.c
8
===================================================================
9
--- net-snmp-5.7.2~dfsg.orig/agent/mibgroup/mibII/icmp.c 2014-03-11 09:17:48.404183162 -0400
10
+++ net-snmp-5.7.2~dfsg/agent/mibgroup/mibII/icmp.c 2014-03-11 09:17:48.396183162 -0400
16
+/* Linux keeps track of all possible message types */
17
+#define ICMP_MSG_STATS_IPV4_COUNT 256
19
#define ICMP_MSG_STATS_IPV4_COUNT 11
22
#ifdef NETSNMP_ENABLE_IPV6
24
+/* Linux keeps track of all possible message types */
25
+#define ICMP_MSG_STATS_IPV6_COUNT 256
27
#define ICMP_MSG_STATS_IPV6_COUNT 14
30
#define ICMP_MSG_STATS_IPV6_COUNT 0
31
#endif /* NETSNMP_ENABLE_IPV6 */
34
linux_read_icmp_msg_stat(&v4icmp, &v4icmpmsg, &flag);
38
if (v4icmpmsg.vals[k].InType) {
39
icmp_msg_stats_table[i].ipVer = 1;
40
icmp_msg_stats_table[i].icmpMsgStatsType = k;
43
linux_read_icmp6_msg_stat(&v6icmp, &v6icmpmsg, &flag);
47
if (v6icmpmsg.vals[k].InType) {
48
icmp_msg_stats_table[i].ipVer = 2;
49
icmp_msg_stats_table[i].icmpMsgStatsType = k;
50
@@ -1050,6 +1060,12 @@
52
table_info = netsnmp_extract_table_info(request);
53
subid = table_info->colnum;
54
+ DEBUGMSGTL(( "mibII/icmpStatsTable", "oid: " ));
55
+ DEBUGMSGOID(( "mibII/icmpStatsTable", request->requestvb->name,
56
+ request->requestvb->name_length ));
57
+ DEBUGMSG(( "mibII/icmpStatsTable", " In %d InErr %d Out %d OutErr %d\n",
58
+ entry->icmpStatsInMsgs, entry->icmpStatsInErrors,
59
+ entry->icmpStatsOutMsgs, entry->icmpStatsOutErrors ));
63
@@ -1117,6 +1133,11 @@
65
table_info = netsnmp_extract_table_info(request);
66
subid = table_info->colnum;
67
+ DEBUGMSGTL(( "mibII/icmpMsgStatsTable", "oid: " ));
68
+ DEBUGMSGOID(( "mibII/icmpMsgStatsTable", request->requestvb->name,
69
+ request->requestvb->name_length ));
70
+ DEBUGMSG(( "mibII/icmpMsgStatsTable", " In %d Out %d Flags 0x%x\n",
71
+ entry->icmpMsgStatsInPkts, entry->icmpMsgStatsOutPkts, entry->flags ));
74
case ICMP_MSG_STAT_IN_PKTS:
75
Index: net-snmp-5.7.2~dfsg/agent/mibgroup/mibII/kernel_linux.c
76
===================================================================
77
--- net-snmp-5.7.2~dfsg.orig/agent/mibgroup/mibII/kernel_linux.c 2014-03-11 09:17:48.404183162 -0400
78
+++ net-snmp-5.7.2~dfsg/agent/mibgroup/mibII/kernel_linux.c 2014-03-11 09:17:48.396183162 -0400
80
index = strtol(token, &delim, 0);
81
if (ERANGE == errno) {
83
- } else if (index > LONG_MAX) {
84
+ } else if (index > 255) {
86
- } else if (index < LONG_MIN) {
87
+ } else if (index < 0) {
90
if (NULL == (token = strtok_r(dataptr, " ", &saveptr1)))
92
index = strtol(token, &delim, 0);
93
if (ERANGE == errno) {
95
- } else if (index > LONG_MAX) {
96
+ } else if (index > 255) {
98
- } else if (index < LONG_MIN) {
99
+ } else if (index < 0) {
102
if(NULL == (token = strtok_r(dataptr, " ", &saveptr1)))
103
@@ -426,14 +426,21 @@
106
if (NULL != icmp6msgstat) {
108
if (0 == strncmp(name, "Icmp6OutType", 12)) {
110
- icmp6msgstat->vals[atoi(vals)].OutType = stats;
112
+ if ( type < 0 || type > 255 )
114
+ icmp6msgstat->vals[type].OutType = stats;
117
} else if (0 == strncmp(name, "Icmp6InType", 11)) {
119
- icmp6msgstat->vals[atoi(vals)].InType = stats;
121
+ if ( type < 0 || type > 255 )
123
+ icmp6msgstat->vals[type].InType = stats;
127
Index: net-snmp-5.7.2~dfsg/agent/mibgroup/mibII/kernel_linux.h
128
===================================================================
129
--- net-snmp-5.7.2~dfsg.orig/agent/mibgroup/mibII/kernel_linux.h 2014-03-11 09:17:48.404183162 -0400
130
+++ net-snmp-5.7.2~dfsg/agent/mibgroup/mibII/kernel_linux.h 2014-03-11 09:17:48.396183162 -0400
131
@@ -121,11 +121,11 @@
133
/* Lets use wrapper structures for future expansion */
134
struct icmp4_msg_mib {
135
- struct icmp_msg_mib vals[255];
136
+ struct icmp_msg_mib vals[256];
139
struct icmp6_msg_mib {
140
- struct icmp_msg_mib vals[255];
141
+ struct icmp_msg_mib vals[256];