diff options
Diffstat (limited to 'agent')
-rw-r--r-- | agent/Makefile.depend | 12 | ||||
-rw-r--r-- | agent/helpers/Makefile.depend | 18 | ||||
-rw-r--r-- | agent/mibgroup/Makefile.depend | 16 | ||||
-rw-r--r-- | agent/mibgroup/mibII/icmp.c | 25 | ||||
-rw-r--r-- | agent/mibgroup/mibII/kernel_linux.c | 19 | ||||
-rw-r--r-- | agent/mibgroup/mibII/kernel_linux.h | 4 |
6 files changed, 61 insertions, 33 deletions
diff --git a/agent/Makefile.depend b/agent/Makefile.depend index cf72cbf..9a1320b 100644 --- a/agent/Makefile.depend +++ b/agent/Makefile.depend @@ -1727,7 +1727,7 @@ ./snmpd.lo: ../include/net-snmp/library/snmp.h ./snmpd.lo: ../include/net-snmp/library/snmp-tc.h ./snmpd.lo: ../include/net-snmp/net-snmp-includes.h -./snmpd.lo: ../include/net-snmp/library/getopt.h +./snmpd.lo: ../include/net-snmp/library/getopt.h ./snmpd.lo: ../include/net-snmp/utilities.h ./snmpd.lo: ../include/net-snmp/library/system.h ./snmpd.lo: ../include/net-snmp/library/tools.h @@ -1800,9 +1800,8 @@ ./snmpd.lo: ../include/net-snmp/agent/mib_modules.h mibgroup/smux/smux.h ./snmp_perl.lo: ../include/net-snmp/net-snmp-config.h ./snmp_perl.lo: ../include/net-snmp/net-snmp-includes.h -./snmp_perl.lo: ../include/net-snmp/definitions.h -./snmp_perl.lo: ../include/net-snmp/types.h -./snmp_perl.lo: ../include/net-snmp/library/oid.h +./snmp_perl.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h +./snmp_perl.lo: ../include/net-snmp/library/oid.h ./snmp_perl.lo: ../include/net-snmp/library/types.h ./snmp_perl.lo: ../include/net-snmp/library/snmp_api.h ./snmp_perl.lo: ../include/net-snmp/varbind_api.h @@ -1907,8 +1906,9 @@ ./snmp_perl.lo: ../include/net-snmp/agent/snmp_get_statistic.h snmp_perl.h ./snmp_vars.lo: ../include/net-snmp/net-snmp-config.h ./snmp_vars.lo: ../include/net-snmp/net-snmp-includes.h -./snmp_vars.lo: ../include/net-snmp/definitions.h ../include/net-snmp/types.h -./snmp_vars.lo: ../include/net-snmp/library/oid.h +./snmp_vars.lo: ../include/net-snmp/definitions.h +./snmp_vars.lo: ../include/net-snmp/types.h +./snmp_vars.lo: ../include/net-snmp/library/oid.h ./snmp_vars.lo: ../include/net-snmp/library/types.h ./snmp_vars.lo: ../include/net-snmp/library/snmp_api.h ./snmp_vars.lo: ../include/net-snmp/varbind_api.h diff --git a/agent/helpers/Makefile.depend b/agent/helpers/Makefile.depend index 1023c66..6bc869a 100644 --- a/agent/helpers/Makefile.depend +++ b/agent/helpers/Makefile.depend @@ -543,7 +543,7 @@ ./instance.lo: ../../include/net-snmp/net-snmp-config.h ./instance.lo: ../../include/net-snmp/net-snmp-features.h ./instance.lo: ../../include/net-snmp/net-snmp-includes.h -./instance.lo: ../../include/net-snmp/definitions.h +./instance.lo: ../../include/net-snmp/definitions.h ./instance.lo: ../../include/net-snmp/types.h ./instance.lo: ../../include/net-snmp/library/oid.h ./instance.lo: ../../include/net-snmp/library/types.h @@ -970,7 +970,7 @@ ./null.lo: ../../include/net-snmp/agent/snmp_get_statistic.h ./old_api.lo: ../../include/net-snmp/net-snmp-config.h ./old_api.lo: ../../include/net-snmp/net-snmp-includes.h -./old_api.lo: ../../include/net-snmp/definitions.h +./old_api.lo: ../../include/net-snmp/definitions.h ./old_api.lo: ../../include/net-snmp/types.h ./old_api.lo: ../../include/net-snmp/library/oid.h ./old_api.lo: ../../include/net-snmp/library/types.h @@ -1078,7 +1078,7 @@ ./old_api.lo: ../../include/net-snmp/agent/agent_callbacks.h ./read_only.lo: ../../include/net-snmp/net-snmp-config.h ./read_only.lo: ../../include/net-snmp/net-snmp-includes.h -./read_only.lo: ../../include/net-snmp/definitions.h +./read_only.lo: ../../include/net-snmp/definitions.h ./read_only.lo: ../../include/net-snmp/types.h ./read_only.lo: ../../include/net-snmp/library/oid.h ./read_only.lo: ../../include/net-snmp/library/types.h @@ -1186,7 +1186,7 @@ ./row_merge.lo: ../../include/net-snmp/net-snmp-config.h ./row_merge.lo: ../../include/net-snmp/net-snmp-features.h ./row_merge.lo: ../../include/net-snmp/net-snmp-includes.h -./row_merge.lo: ../../include/net-snmp/definitions.h +./row_merge.lo: ../../include/net-snmp/definitions.h ./row_merge.lo: ../../include/net-snmp/types.h ./row_merge.lo: ../../include/net-snmp/library/oid.h ./row_merge.lo: ../../include/net-snmp/library/types.h @@ -1292,7 +1292,7 @@ ./row_merge.lo: ../../include/net-snmp/agent/snmp_get_statistic.h ./scalar.lo: ../../include/net-snmp/net-snmp-config.h ./scalar.lo: ../../include/net-snmp/net-snmp-includes.h -./scalar.lo: ../../include/net-snmp/definitions.h +./scalar.lo: ../../include/net-snmp/definitions.h ./scalar.lo: ../../include/net-snmp/types.h ./scalar.lo: ../../include/net-snmp/library/oid.h ./scalar.lo: ../../include/net-snmp/library/types.h @@ -1506,7 +1506,7 @@ ./scalar_group.lo: ../../include/net-snmp/agent/snmp_get_statistic.h ./serialize.lo: ../../include/net-snmp/net-snmp-config.h ./serialize.lo: ../../include/net-snmp/net-snmp-includes.h -./serialize.lo: ../../include/net-snmp/definitions.h +./serialize.lo: ../../include/net-snmp/definitions.h ./serialize.lo: ../../include/net-snmp/types.h ./serialize.lo: ../../include/net-snmp/library/oid.h ./serialize.lo: ../../include/net-snmp/library/types.h @@ -2046,7 +2046,7 @@ ./table.lo: ../../include/net-snmp/net-snmp-config.h ./table.lo: ../../include/net-snmp/net-snmp-features.h ./table.lo: ../../include/net-snmp/net-snmp-includes.h -./table.lo: ../../include/net-snmp/definitions.h +./table.lo: ../../include/net-snmp/definitions.h ./table.lo: ../../include/net-snmp/types.h ./table.lo: ../../include/net-snmp/library/oid.h ./table.lo: ../../include/net-snmp/library/types.h @@ -2582,7 +2582,7 @@ ./table_row.lo: ../../include/net-snmp/net-snmp-config.h ./table_row.lo: ../../include/net-snmp/net-snmp-features.h ./table_row.lo: ../../include/net-snmp/net-snmp-includes.h -./table_row.lo: ../../include/net-snmp/definitions.h +./table_row.lo: ../../include/net-snmp/definitions.h ./table_row.lo: ../../include/net-snmp/types.h ./table_row.lo: ../../include/net-snmp/library/oid.h ./table_row.lo: ../../include/net-snmp/library/types.h @@ -2796,7 +2796,7 @@ ./watcher.lo: ../../include/net-snmp/net-snmp-config.h ./watcher.lo: ../../include/net-snmp/net-snmp-features.h ./watcher.lo: ../../include/net-snmp/net-snmp-includes.h -./watcher.lo: ../../include/net-snmp/definitions.h +./watcher.lo: ../../include/net-snmp/definitions.h ./watcher.lo: ../../include/net-snmp/types.h ./watcher.lo: ../../include/net-snmp/library/oid.h ./watcher.lo: ../../include/net-snmp/library/types.h diff --git a/agent/mibgroup/Makefile.depend b/agent/mibgroup/Makefile.depend index cee726e..dac364d 100644 --- a/agent/mibgroup/Makefile.depend +++ b/agent/mibgroup/Makefile.depend @@ -5588,7 +5588,7 @@ ./ip-mib/ip_scalars.lo: ./ip-mib/ip_scalars.h ./mibII/at.lo: ../../include/net-snmp/net-snmp-config.h ./mibII/at.lo: ./mibII/mibII_common.h -./mibII/at.lo: ../../agent/kernel.h +./mibII/at.lo: ../../agent/kernel.h ./mibII/at.lo: ../../include/net-snmp/net-snmp-includes.h ./mibII/at.lo: ../../include/net-snmp/definitions.h ./mibII/at.lo: ../../include/net-snmp/types.h @@ -6039,7 +6039,7 @@ ./mibII/ipAddr.lo: ./mibII/at.h ./mibII/interfaces.h ./mibII/ip.lo: ../../include/net-snmp/net-snmp-config.h ./mibII/ip.lo: ./mibII/mibII_common.h -./mibII/ip.lo: ../../agent/kernel.h +./mibII/ip.lo: ../../agent/kernel.h ./mibII/ip.lo: ../../include/net-snmp/net-snmp-includes.h ./mibII/ip.lo: ../../include/net-snmp/definitions.h ./mibII/ip.lo: ../../include/net-snmp/types.h @@ -7546,9 +7546,9 @@ ./mibII/tcp.lo: ../../include/net-snmp/net-snmp-config.h ./mibII/tcp.lo: ../../include/net-snmp/net-snmp-features.h ./mibII/tcp.lo: ./mibII/mibII_common.h -./mibII/tcp.lo: ../../agent/kernel.h +./mibII/tcp.lo: ../../agent/kernel.h ./mibII/tcp.lo: ../../include/net-snmp/net-snmp-includes.h -./mibII/tcp.lo: ../../include/net-snmp/definitions.h +./mibII/tcp.lo: ../../include/net-snmp/definitions.h ./mibII/tcp.lo: ../../include/net-snmp/types.h ./mibII/tcp.lo: ../../include/net-snmp/library/oid.h ./mibII/tcp.lo: ../../include/net-snmp/library/types.h @@ -7770,9 +7770,9 @@ ./mibII/tcpTable.lo: ./mibII/tcpTable.h ./mibII/udp.lo: ../../include/net-snmp/net-snmp-config.h ./mibII/udp.lo: ./mibII/mibII_common.h -./mibII/udp.lo: ../../agent/kernel.h +./mibII/udp.lo: ../../agent/kernel.h ./mibII/udp.lo: ../../include/net-snmp/net-snmp-includes.h -./mibII/udp.lo: ../../include/net-snmp/definitions.h +./mibII/udp.lo: ../../include/net-snmp/definitions.h ./mibII/udp.lo: ../../include/net-snmp/types.h ./mibII/udp.lo: ../../include/net-snmp/library/oid.h ./mibII/udp.lo: ../../include/net-snmp/library/types.h @@ -9530,7 +9530,7 @@ ./Rmon/history.lo: ./Rmon/history.h ./Rmon/agutil_api.h ./Rmon/row_api.h ./Rmon/rows.lo: ../../include/net-snmp/net-snmp-config.h ./Rmon/rows.lo: ../../include/net-snmp/net-snmp-includes.h -./Rmon/rows.lo: ../../include/net-snmp/definitions.h +./Rmon/rows.lo: ../../include/net-snmp/definitions.h ./Rmon/rows.lo: ../../include/net-snmp/types.h ./Rmon/rows.lo: ../../include/net-snmp/library/oid.h ./Rmon/rows.lo: ../../include/net-snmp/library/types.h @@ -11619,7 +11619,7 @@ ./smux/smux.lo: ../../include/net-snmp/net-snmp-config.h ./smux/smux.lo: ../../include/net-snmp/net-snmp-features.h ./smux/smux.lo: ../../include/net-snmp/net-snmp-includes.h -./smux/smux.lo: ../../include/net-snmp/definitions.h +./smux/smux.lo: ../../include/net-snmp/definitions.h ./smux/smux.lo: ../../include/net-snmp/types.h ./smux/smux.lo: ../../include/net-snmp/library/oid.h ./smux/smux.lo: ../../include/net-snmp/library/types.h diff --git a/agent/mibgroup/mibII/icmp.c b/agent/mibgroup/mibII/icmp.c index 14c73a6..6d10426 100644 --- a/agent/mibgroup/mibII/icmp.c +++ b/agent/mibgroup/mibII/icmp.c @@ -106,10 +106,20 @@ struct icmp_msg_stats_table_entry { int flags; }; +#ifdef linux +/* Linux keeps track of all possible message types */ +#define ICMP_MSG_STATS_IPV4_COUNT 256 +#else #define ICMP_MSG_STATS_IPV4_COUNT 11 +#endif #ifdef NETSNMP_ENABLE_IPV6 +#ifdef linux +/* Linux keeps track of all possible message types */ +#define ICMP_MSG_STATS_IPV6_COUNT 256 +#else #define ICMP_MSG_STATS_IPV6_COUNT 14 +#endif #else #define ICMP_MSG_STATS_IPV6_COUNT 0 #endif /* NETSNMP_ENABLE_IPV6 */ @@ -177,7 +187,7 @@ icmp_msg_stats_load(netsnmp_cache *cache, void *vmagic) inc = 0; linux_read_icmp_msg_stat(&v4icmp, &v4icmpmsg, &flag); if (flag) { - while (254 != k) { + while (255 >= k) { if (v4icmpmsg.vals[k].InType) { icmp_msg_stats_table[i].ipVer = 1; icmp_msg_stats_table[i].icmpMsgStatsType = k; @@ -267,7 +277,7 @@ icmp_msg_stats_load(netsnmp_cache *cache, void *vmagic) inc = 0; linux_read_icmp6_msg_stat(&v6icmp, &v6icmpmsg, &flag); if (flag) { - while (254 != k) { + while (255 >= k) { if (v6icmpmsg.vals[k].InType) { icmp_msg_stats_table[i].ipVer = 2; icmp_msg_stats_table[i].icmpMsgStatsType = k; @@ -1050,6 +1060,12 @@ icmp_stats_table_handler(netsnmp_mib_handler *handler, continue; table_info = netsnmp_extract_table_info(request); subid = table_info->colnum; + DEBUGMSGTL(( "mibII/icmpStatsTable", "oid: " )); + DEBUGMSGOID(( "mibII/icmpStatsTable", request->requestvb->name, + request->requestvb->name_length )); + DEBUGMSG(( "mibII/icmpStatsTable", " In %d InErr %d Out %d OutErr %d\n", + entry->icmpStatsInMsgs, entry->icmpStatsInErrors, + entry->icmpStatsOutMsgs, entry->icmpStatsOutErrors )); switch (subid) { case ICMP_STAT_INMSG: @@ -1117,6 +1133,11 @@ icmp_msg_stats_table_handler(netsnmp_mib_handler *handler, continue; table_info = netsnmp_extract_table_info(request); subid = table_info->colnum; + DEBUGMSGTL(( "mibII/icmpMsgStatsTable", "oid: " )); + DEBUGMSGOID(( "mibII/icmpMsgStatsTable", request->requestvb->name, + request->requestvb->name_length )); + DEBUGMSG(( "mibII/icmpMsgStatsTable", " In %d Out %d Flags 0x%x\n", + entry->icmpMsgStatsInPkts, entry->icmpMsgStatsOutPkts, entry->flags )); switch (subid) { case ICMP_MSG_STAT_IN_PKTS: diff --git a/agent/mibgroup/mibII/kernel_linux.c b/agent/mibgroup/mibII/kernel_linux.c index b21a166..ba320c7 100644 --- a/agent/mibgroup/mibII/kernel_linux.c +++ b/agent/mibgroup/mibII/kernel_linux.c @@ -81,9 +81,9 @@ decode_icmp_msg(char *line, char *data, struct icmp4_msg_mib *msg) index = strtol(token, &delim, 0); if (ERANGE == errno) { continue; - } else if (index > LONG_MAX) { + } else if (index > 255) { continue; - } else if (index < LONG_MIN) { + } else if (index < 0) { continue; } if (NULL == (token = strtok_r(dataptr, " ", &saveptr1))) @@ -94,9 +94,9 @@ decode_icmp_msg(char *line, char *data, struct icmp4_msg_mib *msg) index = strtol(token, &delim, 0); if (ERANGE == errno) { continue; - } else if (index > LONG_MAX) { + } else if (index > 255) { continue; - } else if (index < LONG_MIN) { + } else if (index < 0) { continue; } if(NULL == (token = strtok_r(dataptr, " ", &saveptr1))) @@ -426,14 +426,21 @@ linux_read_icmp6_parse(struct icmp6_mib *icmp6stat, vals = name; if (NULL != icmp6msgstat) { + int type; if (0 == strncmp(name, "Icmp6OutType", 12)) { strsep(&vals, "e"); - icmp6msgstat->vals[atoi(vals)].OutType = stats; + type = atoi(vals); + if ( type < 0 || type > 255 ) + continue; + icmp6msgstat->vals[type].OutType = stats; *support = 1; continue; } else if (0 == strncmp(name, "Icmp6InType", 11)) { strsep(&vals, "e"); - icmp6msgstat->vals[atoi(vals)].InType = stats; + type = atoi(vals); + if ( type < 0 || type > 255 ) + continue; + icmp6msgstat->vals[type].InType = stats; *support = 1; continue; } diff --git a/agent/mibgroup/mibII/kernel_linux.h b/agent/mibgroup/mibII/kernel_linux.h index 6bf5d47..c6dfca9 100644 --- a/agent/mibgroup/mibII/kernel_linux.h +++ b/agent/mibgroup/mibII/kernel_linux.h @@ -121,11 +121,11 @@ struct icmp_msg_mib { /* Lets use wrapper structures for future expansion */ struct icmp4_msg_mib { - struct icmp_msg_mib vals[255]; + struct icmp_msg_mib vals[256]; }; struct icmp6_msg_mib { - struct icmp_msg_mib vals[255]; + struct icmp_msg_mib vals[256]; }; struct udp_mib { |