diff options
author | Li Zhou <li.zhou@windriver.com> | 2016-11-23 12:10:39 +0800 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2016-12-14 09:20:09 -0500 |
commit | 50169dcce2a65e3e48505c821d2a49d52f94f572 (patch) | |
tree | 9ac73cbbdd93ceb9d9d98bc76223af1f82fa01d6 /meta-networking/recipes-protocols/net-snmp/net-snmp | |
parent | ba665493a0dddf95797bab6bd17f8bf693f1e153 (diff) | |
download | meta-openembedded-contrib-50169dcce2a65e3e48505c821d2a49d52f94f572.tar.gz |
net-snmp: fix snmptrap to use clientaddr from snmp.conf.
Under IPv6 IP-multihomed environment, the socket does not bind to the
clientaddr indicated in snmp.conf when sending snmptrap and it might
choose a random one.
Backport the patch from net-snmp upstream to fix it.
Signed-off-by: Li Zhou <li.zhou@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-protocols/net-snmp/net-snmp')
-rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch new file mode 100644 index 0000000000..b05eea56fc --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch @@ -0,0 +1,48 @@ +From a92628a163ebf1ea62220684736300461c003875 Mon Sep 17 00:00:00 2001 +From: Niels Baggesen <nba@users.sourceforge.net> +Date: Mon, 26 Jan 2015 20:26:06 +0100 +Subject: [PATCH] BUG#a2584: Fix snmptrap to use clientaddr from snmp.conf. + Thanks to rizwan + +Upstream-Status: backport + +Signed-off-by: Li Zhou <li.zhou@windriver.com> +--- + snmplib/transports/snmpUDPIPv6Domain.c | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c +index 55e3610..aca69ae 100644 +--- a/snmplib/transports/snmpUDPIPv6Domain.c ++++ b/snmplib/transports/snmpUDPIPv6Domain.c +@@ -256,6 +256,27 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local) + t->data = NULL; + t->data_length = 0; + } else { ++ char *client_socket = NULL; ++ /* ++ * This is a client session. If we've been given a ++ * client address to send from, then bind to that. ++ * Otherwise the send will use "something sensible". ++ */ ++ ++ client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, ++ NETSNMP_DS_LIB_CLIENT_ADDR); ++ if (client_socket) { ++ struct sockaddr_in6 client_addr; ++ netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL); ++ rc = bind(t->sock, (struct sockaddr *)&client_addr, ++ sizeof(struct sockaddr_in6)); ++ if ( rc != 0 ) { ++ DEBUGMSGTL(("netsnmp_udp6", "failed to bind for clientaddr: %d %s\n", ++ errno, strerror(errno))); ++ netsnmp_socketbase_close(t); ++ netsnmp_transport_free(t); ++ } ++ } + /* + * This is a client session. Save the address in the + * transport-specific data pointer for later use by netsnmp_udp6_send. +-- +2.9.3 + |