|
|
34d7f3 |
1190679 - In IPv6, snmp packet does not send from specified interface assigned by clientaddr option in snmpd.conf
|
|
|
34d7f3 |
|
|
|
34d7f3 |
commit a92628a163ebf1ea62220684736300461c003875
|
|
|
34d7f3 |
Author: Niels Baggesen <nba@users.sourceforge.net>
|
|
|
34d7f3 |
Date: Mon Jan 26 20:26:06 2015 +0100
|
|
|
34d7f3 |
|
|
|
34d7f3 |
BUG#a2584: Fix snmptrap to use clientaddr from snmp.conf. Thanks to rizwan
|
|
|
34d7f3 |
|
|
|
34d7f3 |
+ restore clientaddrUsesPort functionality for UDPv6
|
|
|
34d7f3 |
|
|
|
34d7f3 |
diff -up net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c.udp6-clientaddr net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c
|
|
|
34d7f3 |
--- net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c.udp6-clientaddr 2015-06-17 15:00:50.178122151 +0200
|
|
|
34d7f3 |
+++ net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c 2015-06-17 15:01:09.203194870 +0200
|
|
|
34d7f3 |
@@ -284,6 +284,27 @@ netsnmp_udp6_transport(struct sockaddr_i
|
|
|
34d7f3 |
return NULL;
|
|
|
34d7f3 |
#endif /* NETSNMP_NO_LISTEN_SUPPORT */
|
|
|
34d7f3 |
} else {
|
|
|
34d7f3 |
+ char *client_socket = NULL;
|
|
|
34d7f3 |
+ /*
|
|
|
34d7f3 |
+ * This is a client session. If we've been given a
|
|
|
34d7f3 |
+ * client address to send from, then bind to that.
|
|
|
34d7f3 |
+ * Otherwise the send will use "something sensible".
|
|
|
34d7f3 |
+ */
|
|
|
34d7f3 |
+
|
|
|
34d7f3 |
+ client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
|
|
|
34d7f3 |
+ NETSNMP_DS_LIB_CLIENT_ADDR);
|
|
|
34d7f3 |
+ if (client_socket) {
|
|
|
34d7f3 |
+ struct sockaddr_in6 client_addr;
|
|
|
34d7f3 |
+ netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL);
|
|
|
34d7f3 |
+ rc = bind(t->sock, (struct sockaddr *)&client_addr,
|
|
|
34d7f3 |
+ sizeof(struct sockaddr_in6));
|
|
|
34d7f3 |
+ if ( rc != 0 ) {
|
|
|
34d7f3 |
+ DEBUGMSGTL(("netsnmp_udp6", "failed to bind for clientaddr: %d %s\n",
|
|
|
34d7f3 |
+ errno, strerror(errno)));
|
|
|
34d7f3 |
+ netsnmp_socketbase_close(t);
|
|
|
34d7f3 |
+ netsnmp_transport_free(t);
|
|
|
34d7f3 |
+ }
|
|
|
34d7f3 |
+ }
|
|
|
34d7f3 |
/*
|
|
|
34d7f3 |
* This is a client session. Save the address in the
|
|
|
34d7f3 |
* transport-specific data pointer for later use by netsnmp_udp6_send.
|
|
|
34d7f3 |
diff -up net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c.old net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c
|
|
|
34d7f3 |
--- net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c.old 2015-06-17 16:34:09.120181912 +0200
|
|
|
34d7f3 |
+++ net-snmp-5.7.2/snmplib/transports/snmpUDPIPv6Domain.c 2015-06-17 16:35:29.803192111 +0200
|
|
|
34d7f3 |
@@ -294,8 +294,13 @@ netsnmp_udp6_transport(struct sockaddr_i
|
|
|
34d7f3 |
client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
|
|
|
34d7f3 |
NETSNMP_DS_LIB_CLIENT_ADDR);
|
|
|
34d7f3 |
if (client_socket) {
|
|
|
34d7f3 |
+ int uses_port = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
|
|
|
34d7f3 |
+ NETSNMP_DS_LIB_CLIENT_ADDR_USES_PORT);
|
|
|
34d7f3 |
struct sockaddr_in6 client_addr;
|
|
|
34d7f3 |
netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL);
|
|
|
34d7f3 |
+ if (uses_port == 0) {
|
|
|
34d7f3 |
+ client_addr.sin6_port = 0;
|
|
|
34d7f3 |
+ }
|
|
|
34d7f3 |
rc = bind(t->sock, (struct sockaddr *)&client_addr,
|
|
|
34d7f3 |
sizeof(struct sockaddr_in6));
|
|
|
34d7f3 |
if ( rc != 0 ) {
|
|
|
34d7f3 |
commit 1ee72102fbe722d232d74abc4660a8b134cec8d6
|
|
|
34d7f3 |
Author: Bart Van Assche <bvanassche@acm.org>
|
|
|
34d7f3 |
Date: Sat May 23 07:32:53 2015 +0200
|
|
|
34d7f3 |
|
|
|
34d7f3 |
snmplib, UDPIPv6 transport: Add a missing return statement
|
|
|
34d7f3 |
|
|
|
34d7f3 |
Detected by Coverity.
|
|
|
34d7f3 |
|
|
|
34d7f3 |
diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
|
|
|
34d7f3 |
index 029b164..11c39bb 100644
|
|
|
34d7f3 |
--- a/snmplib/transports/snmpUDPIPv6Domain.c
|
|
|
34d7f3 |
+++ b/snmplib/transports/snmpUDPIPv6Domain.c
|
|
|
34d7f3 |
@@ -285,6 +285,7 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
|
|
|
34d7f3 |
errno, strerror(errno)));
|
|
|
34d7f3 |
netsnmp_socketbase_close(t);
|
|
|
34d7f3 |
netsnmp_transport_free(t);
|
|
|
34d7f3 |
+ return NULL;
|
|
|
34d7f3 |
}
|
|
|
34d7f3 |
}
|
|
|
34d7f3 |
/*
|