diff options
Diffstat (limited to 'net-analyzer/net-snmp/files')
-rw-r--r-- | net-analyzer/net-snmp/files/digest-net-snmp-5.4.1 | 3 | ||||
-rw-r--r-- | net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch | 63 |
2 files changed, 66 insertions, 0 deletions
diff --git a/net-analyzer/net-snmp/files/digest-net-snmp-5.4.1 b/net-analyzer/net-snmp/files/digest-net-snmp-5.4.1 new file mode 100644 index 000000000000..34865f92ea1e --- /dev/null +++ b/net-analyzer/net-snmp/files/digest-net-snmp-5.4.1 @@ -0,0 +1,3 @@ +MD5 6c974df7a5a5b1579f72115e6b045bda net-snmp-5.4.1.tar.gz 5122455 +RMD160 3723488dab8d164702a7d55c9c72eeaec07dd50c net-snmp-5.4.1.tar.gz 5122455 +SHA256 0ea976722c993c87dede8eb6348e6feb059e3851bbef2de824bf18ac97cdb565 net-snmp-5.4.1.tar.gz 5122455 diff --git a/net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch b/net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch new file mode 100644 index 000000000000..116e524f0c85 --- /dev/null +++ b/net-analyzer/net-snmp/files/net-snmp-5.4.1-clientaddr-fix.patch @@ -0,0 +1,63 @@ +Fix clientaddr functionality. + +Previously, the clientaddr option in snmp.conf was parsed, but the actual +clientaddr was used to bind(), yet sendmsg() was still called with 0.0.0.0. + +This patch alters: +- netsnmp_udp_fmtaddr: include both sides of addr_pair for debugging. +- netsnmp_udp_transport: Set addr_pair->local_addr in the remote && client_socket path. +- netsnmp_udp_transport: Print a debugging error on failure to bind() +- netsnmp_udp_transport: Print out the full client open addr_pair data. + +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> +Status: Merged in upstream r16654 +Tracking-URL: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=1775124&group_id=12694 + +diff -NuwbBar --exclude docs --exclude '*.o' --exclude 'config.*' --exclude perl --exclude '*~' net-snmp-5.4.old/snmplib/snmpUDPDomain.c net-snmp-5.4/snmplib/snmpUDPDomain.c +--- net-snmp-5.4.old/snmplib/snmpUDPDomain.c 2006-09-19 16:42:17.000000000 -0700 ++++ net-snmp-5.4/snmplib/snmpUDPDomain.c 2007-08-15 19:17:27.000000000 -0700 +@@ -100,12 +100,15 @@ netsnmp_udp_fmtaddr(netsnmp_transport *t + struct sockaddr_in *to = NULL; + char tmp[64]; + to = (struct sockaddr_in *) &(addr_pair->remote_addr); ++ /* Using strdup on the output of inet_ntoa is important! */ + if (to == NULL) { +- return strdup("UDP: unknown"); ++ sprintf(tmp, "UDP: [%s]->unknown", ++ strdup(inet_ntoa(addr_pair->local_addr))); ++ } else { ++ sprintf(tmp, "UDP: [%s]->[%s]:%hu", ++ strdup(inet_ntoa(addr_pair->local_addr)), ++ strdup(inet_ntoa(to->sin_addr)), ntohs(to->sin_port)); + } +- +- sprintf(tmp, "UDP: [%s]:%hu", +- inet_ntoa(to->sin_addr), ntohs(to->sin_port)); + return strdup(tmp); + } + } +@@ -670,11 +673,23 @@ netsnmp_udp_transport(struct sockaddr_in + NETSNMP_DS_LIB_CLIENT_ADDR); + if (client_socket) { + struct sockaddr_in client_addr; ++ int ret; + netsnmp_sockaddr_in2(&client_addr, client_socket, NULL); ++ addr_pair.local_addr = client_addr.sin_addr; + client_addr.sin_port = 0; +- bind(t->sock, (struct sockaddr *)&client_addr, ++ ret = bind(t->sock, (struct sockaddr *)&client_addr, + sizeof(struct sockaddr)); ++ if(ret) ++ DEBUGMSGTL(("netsnmp_udp", "failed to bind for clientaddr: %d %s\n", ++ errno,strerror(errno))); ++ /* TODO: should we exit here? */ + } ++ ++ str = netsnmp_udp_fmtaddr(NULL, (void *)&addr_pair, ++ sizeof(netsnmp_udp_addr_pair)); ++ DEBUGMSGTL(("netsnmp_udp", "client open %s\n", str)); ++ free(str); ++ + /* + * Save the (remote) address in the + * transport-specific data pointer for later use by netsnmp_udp_send. |