diff options
author | Matthew Marlowe <mattm@gentoo.org> | 2006-10-23 13:04:30 +0000 |
---|---|---|
committer | Matthew Marlowe <mattm@gentoo.org> | 2006-10-23 13:04:30 +0000 |
commit | c006020bb85ab65faa04cdd62aa74b67697dcde2 (patch) | |
tree | a90f263a513b91c6a13a721af22c37eabde3f572 /net-analyzer/net-snmp/files | |
parent | removed quotes around socket, fix bug #152455 (diff) | |
download | gentoo-2-c006020bb85ab65faa04cdd62aa74b67697dcde2.tar.gz gentoo-2-c006020bb85ab65faa04cdd62aa74b67697dcde2.tar.bz2 gentoo-2-c006020bb85ab65faa04cdd62aa74b67697dcde2.zip |
added some patches to net-snmp-5.3.1 to deal with 64 bit issues among others (patch source: redhat). Should hopefully make amd64/sun users happy.
(Portage version: 2.1.1)
Diffstat (limited to 'net-analyzer/net-snmp/files')
4 files changed, 331 insertions, 0 deletions
diff --git a/net-analyzer/net-snmp/files/digest-net-snmp-5.3.0.1 b/net-analyzer/net-snmp/files/digest-net-snmp-5.3.0.1 index 9422e94f60a7..7008f1a40c6d 100644 --- a/net-analyzer/net-snmp/files/digest-net-snmp-5.3.0.1 +++ b/net-analyzer/net-snmp/files/digest-net-snmp-5.3.0.1 @@ -1 +1,3 @@ MD5 db5995ff8fae154cbe7417a4a6f2ca60 net-snmp-5.3.0.1.tar.gz 4183370 +RMD160 86b7e56b512faf73d2a08ac3df2def4560b62945 net-snmp-5.3.0.1.tar.gz 4183370 +SHA256 dc7786ad2b1464edb5d8331a2687fa72f979ce3984df4e94334e8eec0676e69d net-snmp-5.3.0.1.tar.gz 4183370 diff --git a/net-analyzer/net-snmp/files/digest-net-snmp-5.3.1-r1 b/net-analyzer/net-snmp/files/digest-net-snmp-5.3.1-r1 new file mode 100644 index 000000000000..c0eb0c226959 --- /dev/null +++ b/net-analyzer/net-snmp/files/digest-net-snmp-5.3.1-r1 @@ -0,0 +1,3 @@ +MD5 360a9783dbc853bab6bda90d961daee5 net-snmp-5.3.1.tar.gz 4210843 +RMD160 7bcdd213fb2517d0927b030deab5146522b58b3d net-snmp-5.3.1.tar.gz 4210843 +SHA256 fb6d5113ccdd8c4661fe5d825160e45a7c5035b145e24ec18f71a509ecb0fe43 net-snmp-5.3.1.tar.gz 4210843 diff --git a/net-analyzer/net-snmp/files/net-snmp-5.3.1-retrans-time.patch b/net-analyzer/net-snmp/files/net-snmp-5.3.1-retrans-time.patch new file mode 100644 index 000000000000..45eb35cff2a8 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.3.1-retrans-time.patch @@ -0,0 +1,93 @@ +Index: agent/mibgroup/if-mib/data_access/interface_linux.c +=================================================================== +--- agent/mibgroup/if-mib/data_access/interface_linux.c.orig ++++ agent/mibgroup/if-mib/data_access/interface_linux.c +@@ -22,6 +22,8 @@ + #include "interface_ioctl.h" + + #include <sys/types.h> ++#include <sys/stat.h> ++#include <unistd.h> + + #ifdef HAVE_LINUX_ETHTOOL_H + #include <sys/types.h> +@@ -40,6 +42,10 @@ unsigned int + netsnmp_linux_interface_get_if_speed_mii(int fd, const char *name); + #endif + ++#define PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS "/proc/sys/net/ipv%d/neigh/%s/retrans_time_ms" ++#define PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME "/proc/sys/net/ipv%d/neigh/%s/retrans_time" ++static char *proc_sys_retrans_time; ++static unsigned short retrans_time_factor = 0; + + void + netsnmp_arch_interface_init(void) +@@ -47,6 +53,20 @@ netsnmp_arch_interface_init(void) + /* + * nothing to do + */ ++ char proc_path[64+IF_NAMESIZE]; ++ char proc_path2[64+IF_NAMESIZE]; ++ struct stat st; ++ ++ snprintf(proc_path, sizeof(proc_path), PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS, 6, "default"); ++ snprintf(proc_path2, sizeof(proc_path2), PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS, 4, "default"); ++ ++ if ((stat(proc_path, &st) == 0) || (stat(proc_path2, &st) == 0)) { ++ proc_sys_retrans_time = PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS; ++ } ++ else { ++ proc_sys_retrans_time = PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME; ++ retrans_time_factor = 10; ++ } + } + + /* +@@ -161,7 +181,7 @@ _arch_interface_flags_v4_get(netsnmp_int + /* + * get the retransmit time + */ +- snprintf(line,sizeof(line),"/proc/sys/net/ipv4/neigh/%s/retrans_time", ++ snprintf(line,sizeof(line),proc_sys_retrans_time, 4, + entry->name); + if (!(fin = fopen(line, "r"))) { + DEBUGMSGTL(("access:interface", +@@ -169,7 +189,12 @@ _arch_interface_flags_v4_get(netsnmp_int + } + else { + if (fgets(line, sizeof(line), fin)) { +- entry->retransmit_v4 = atoi(line) * 100; ++ if (retrans_time_factor) { ++ entry->retransmit_v4 = atoi(line) * retrans_time_factor; ++ } ++ else { ++ entry->retransmit_v4 = atoi(line); ++ }; + entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V4_RETRANSMIT; + } + fclose(fin); +@@ -191,7 +216,7 @@ _arch_interface_flags_v6_get(netsnmp_int + /* + * get the retransmit time + */ +- snprintf(line,sizeof(line),"/proc/sys/net/ipv6/neigh/%s/retrans_time", ++ snprintf(line,sizeof(line),proc_sys_retrans_time, 6, + entry->name); + if (!(fin = fopen(line, "r"))) { + DEBUGMSGTL(("access:interface", +@@ -199,7 +224,12 @@ _arch_interface_flags_v6_get(netsnmp_int + } + else { + if (fgets(line, sizeof(line), fin)) { +- entry->retransmit_v6 = atoi(line); ++ if (retrans_time_factor) { ++ entry->retransmit_v6 = atoi(line) * retrans_time_factor; ++ } ++ else { ++ entry->retransmit_v6 = atoi(line); ++ }; + entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT; + } + fclose(fin); + + diff --git a/net-analyzer/net-snmp/files/net-snmp-5.3.1-tcp-udp-mib-byteorder.patch b/net-analyzer/net-snmp/files/net-snmp-5.3.1-tcp-udp-mib-byteorder.patch new file mode 100644 index 000000000000..389cd2bfd873 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.3.1-tcp-udp-mib-byteorder.patch @@ -0,0 +1,233 @@ +Index: agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c +=================================================================== +RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c,v +retrieving revision 1.5.2.1 +diff -u -p -u -r1.5.2.1 tcpConn_linux.c +--- agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c 17 Aug 2006 08:52:15 -0000 1.5.2.1 ++++ agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c 1 Sep 2006 17:15:23 -0000 +@@ -169,11 +169,20 @@ _load4(netsnmp_container *container, u_i + break; + } + +- entry->loc_port = htons((unsigned short) local_port); +- entry->rmt_port = htons((unsigned short) remote_port); ++ /** oddly enough, these appear to already be in network order */ ++ entry->loc_port = (unsigned short) local_port; ++ entry->rmt_port = (unsigned short) remote_port; + entry->tcpConnState = state; ++ ++ /** the addr string may need work */ + buf_len = strlen(local_addr); +- netsnmp_assert(8 == buf_len); ++ if ((8 != buf_len) || ++ (-1 == netsnmp_addrstr_hton(local_addr, 8))) { ++ DEBUGMSGT(("verbose:access:tcpconn:container", ++ " error processing local address\n")); ++ netsnmp_access_tcpconn_entry_free(entry); ++ continue; ++ } + offset = 0; + tmp_ptr = entry->loc_addr; + rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len, +@@ -188,8 +197,15 @@ _load4(netsnmp_container *container, u_i + continue; + } + +- buf_len = strlen(remote_addr); +- netsnmp_assert(8 == buf_len); ++ /** the addr string may need work */ ++ buf_len = strlen((char*)remote_addr); ++ if ((8 != buf_len) || ++ (-1 == netsnmp_addrstr_hton(remote_addr, 8))) { ++ DEBUGMSGT(("verbose:access:tcpconn:container", ++ " error processing remote address\n")); ++ netsnmp_access_tcpconn_entry_free(entry); ++ continue; ++ } + offset = 0; + tmp_ptr = entry->rmt_addr; + rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len, +@@ -244,6 +260,8 @@ _load6(netsnmp_container *container, u_i + fgets(line, sizeof(line), in); /* skip header */ + + /* ++ * Note: PPC (big endian) ++ * + * sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode + * 0: 00000000000000000000000000000001:1466 00000000000000000000000000000000:0000 0A 00000000:00000000 00:00000000 00000000 500 0 326699 1 efb81580 3000 0 0 2 -1 + */ +@@ -291,11 +309,20 @@ _load6(netsnmp_container *container, u_i + break; + } + +- entry->loc_port = htons((unsigned short) local_port); +- entry->rmt_port = htons((unsigned short) remote_port); ++ /** oddly enough, these appear to already be in network order */ ++ entry->loc_port = (unsigned short) local_port; ++ entry->rmt_port = (unsigned short) remote_port; + entry->tcpConnState = state; + +- buf_len = strlen(local_addr); ++ /** the addr string may need work */ ++ buf_len = strlen((char*)local_addr); ++ if ((32 != buf_len) || ++ (-1 == netsnmp_addrstr_hton(local_addr, 32))) { ++ DEBUGMSGT(("verbose:access:tcpconn:container", ++ " error processing local address\n")); ++ netsnmp_access_tcpconn_entry_free(entry); ++ continue; ++ } + offset = 0; + tmp_ptr = entry->loc_addr; + rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len, +@@ -310,7 +337,14 @@ _load6(netsnmp_container *container, u_i + continue; + } + +- buf_len = strlen(remote_addr); ++ buf_len = strlen((char*)remote_addr); ++ if ((32 != buf_len) || ++ (-1 == netsnmp_addrstr_hton(remote_addr, 32))) { ++ DEBUGMSGT(("verbose:access:tcpconn:container", ++ " error processing remote address\n")); ++ netsnmp_access_tcpconn_entry_free(entry); ++ continue; ++ } + offset = 0; + tmp_ptr = entry->rmt_addr; + rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len, +Index: agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c +=================================================================== +RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c,v +retrieving revision 1.2.2.1 +diff -u -p -u -r1.2.2.1 udp_endpoint_linux.c +--- agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c 25 Jan 2006 16:27:40 -0000 1.2.2.1 ++++ agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c 1 Sep 2006 17:15:23 -0000 +@@ -112,9 +112,9 @@ _process_line_udp_ep(netsnmp_line_info * + struct netsnmp_line_process_info_s* lpi) + { + netsnmp_udp_endpoint_entry *ep = (netsnmp_udp_endpoint_entry *)mem; +- char *ptr; ++ char *ptr, *sep; + u_char *u_ptr; +- size_t u_ptr_len, offset; ++ size_t u_ptr_len, offset, len; + + /* + * skip 'sl' +@@ -135,10 +135,22 @@ _process_line_udp_ep(netsnmp_line_info * + /* + * get local address. ignore error on hex conversion, since that + * function doesn't like the ':' between address and port. check the +- * offset to see if it worked. ++ * offset to see if it worked. May need to flip string too. + */ + u_ptr = ep->loc_addr; + u_ptr_len = sizeof(ep->loc_addr); ++ sep = strchr(ptr, ':'); ++ if (NULL == sep) { ++ DEBUGMSGTL(("text:util:tvi", "no ':' '%s'\n", ++ line_info->start)); ++ return PMLP_RC_MEMORY_UNUSED; ++ } ++ len = (sep - ptr); ++ if (-1 == netsnmp_addrstr_hton(ptr, len)) { ++ DEBUGMSGTL(("text:util:tvi", "bad length %d for loc addr '%s'\n", ++ u_ptr_len, line_info->start)); ++ return PMLP_RC_MEMORY_UNUSED; ++ } + offset = 0; + netsnmp_hex_to_binary(&u_ptr, &u_ptr_len, &offset, 0, ptr, NULL); + if ((4 != offset) && (16 != offset)) { +@@ -159,14 +171,26 @@ _process_line_udp_ep(netsnmp_line_info * + /* + * get remote address. ignore error on hex conversion, since that + * function doesn't like the ':' between address and port. check the +- * offset to see if it worked. ++ * offset to see if it worked. May need to flip string too. + */ + u_ptr = ep->rmt_addr; + u_ptr_len = sizeof(ep->rmt_addr); ++ sep = strchr(ptr, ':'); ++ if (NULL == sep) { ++ DEBUGMSGTL(("text:util:tvi", "no ':' '%s'\n", ++ line_info->start)); ++ return PMLP_RC_MEMORY_UNUSED; ++ } ++ len = (sep - ptr); ++ if (-1 == netsnmp_addrstr_hton(ptr, len)) { ++ DEBUGMSGTL(("text:util:tvi", "bad length %d for rmt addr '%s'\n", ++ u_ptr_len, line_info->start)); ++ return PMLP_RC_MEMORY_UNUSED; ++ } + offset = 0; + netsnmp_hex_to_binary(&u_ptr, &u_ptr_len, &offset, 0, ptr, NULL); + if ((4 != offset) && (16 != offset)) { +- DEBUGMSGTL(("text:util:tvi", "bad offset %d for loc addr '%s'\n", ++ DEBUGMSGTL(("text:util:tvi", "bad offset %d for rmt addr '%s'\n", + offset, line_info->start)); + return PMLP_RC_MEMORY_UNUSED; + } +Index: include/net-snmp/library/tools.h +=================================================================== +RCS file: /cvsroot/net-snmp/net-snmp/include/net-snmp/library/tools.h,v +retrieving revision 5.8.2.2 +diff -u -p -u -r5.8.2.2 tools.h +--- include/net-snmp/library/tools.h 13 Jun 2006 12:50:36 -0000 5.8.2.2 ++++ include/net-snmp/library/tools.h 1 Sep 2006 17:15:24 -0000 +@@ -198,7 +198,9 @@ extern "C" { + int marker_tticks(marker_t pm); + int timeval_tticks(struct timeval *tv); + char *netsnmp_getenv(const char *name); +- ++ ++ int netsnmp_addrstr_hton(char *ptr, size_t len); ++ + #ifdef __cplusplus + } + #endif +Index: snmplib/tools.c +=================================================================== +RCS file: /cvsroot/net-snmp/net-snmp/snmplib/tools.c,v +retrieving revision 5.10.2.2 +diff -u -p -u -r5.10.2.2 tools.c +--- snmplib/tools.c 25 Jul 2006 08:04:35 -0000 5.10.2.2 ++++ snmplib/tools.c 1 Sep 2006 17:15:26 -0000 +@@ -1042,3 +1042,35 @@ char *netsnmp_getenv(const char *name) + #endif + } + ++/* ++ * swap the order of an inet addr string ++ */ ++int ++netsnmp_addrstr_hton(char *ptr, size_t len) ++{ ++#ifndef WORDS_BIGENDIAN ++ char tmp[8]; ++ ++ if (8 == len) { ++ tmp[0] = ptr[6]; ++ tmp[1] = ptr[7]; ++ tmp[2] = ptr[4]; ++ tmp[3] = ptr[5]; ++ tmp[4] = ptr[2]; ++ tmp[5] = ptr[3]; ++ tmp[6] = ptr[0]; ++ tmp[7] = ptr[1]; ++ memcpy (ptr, &tmp, 8); ++ } ++ else if (32 == len) { ++ netsnmp_addrstr_hton(ptr , 8); ++ netsnmp_addrstr_hton(ptr+8 , 8); ++ netsnmp_addrstr_hton(ptr+16, 8); ++ netsnmp_addrstr_hton(ptr+24, 8); ++ } ++ else ++ return -1; ++#endif ++ ++ return 0; ++} + + |