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 | |
parent | ba665493a0dddf95797bab6bd17f8bf693f1e153 (diff) | |
download | meta-openembedded-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')
-rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch | 48 | ||||
-rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb | 1 |
2 files changed, 49 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 000000000..b05eea56f --- /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 @@ | |||
1 | From a92628a163ebf1ea62220684736300461c003875 Mon Sep 17 00:00:00 2001 | ||
2 | From: Niels Baggesen <nba@users.sourceforge.net> | ||
3 | Date: Mon, 26 Jan 2015 20:26:06 +0100 | ||
4 | Subject: [PATCH] BUG#a2584: Fix snmptrap to use clientaddr from snmp.conf. | ||
5 | Thanks to rizwan | ||
6 | |||
7 | Upstream-Status: backport | ||
8 | |||
9 | Signed-off-by: Li Zhou <li.zhou@windriver.com> | ||
10 | --- | ||
11 | snmplib/transports/snmpUDPIPv6Domain.c | 21 +++++++++++++++++++++ | ||
12 | 1 file changed, 21 insertions(+) | ||
13 | |||
14 | diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c | ||
15 | index 55e3610..aca69ae 100644 | ||
16 | --- a/snmplib/transports/snmpUDPIPv6Domain.c | ||
17 | +++ b/snmplib/transports/snmpUDPIPv6Domain.c | ||
18 | @@ -256,6 +256,27 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local) | ||
19 | t->data = NULL; | ||
20 | t->data_length = 0; | ||
21 | } else { | ||
22 | + char *client_socket = NULL; | ||
23 | + /* | ||
24 | + * This is a client session. If we've been given a | ||
25 | + * client address to send from, then bind to that. | ||
26 | + * Otherwise the send will use "something sensible". | ||
27 | + */ | ||
28 | + | ||
29 | + client_socket = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, | ||
30 | + NETSNMP_DS_LIB_CLIENT_ADDR); | ||
31 | + if (client_socket) { | ||
32 | + struct sockaddr_in6 client_addr; | ||
33 | + netsnmp_sockaddr_in6_2(&client_addr, client_socket, NULL); | ||
34 | + rc = bind(t->sock, (struct sockaddr *)&client_addr, | ||
35 | + sizeof(struct sockaddr_in6)); | ||
36 | + if ( rc != 0 ) { | ||
37 | + DEBUGMSGTL(("netsnmp_udp6", "failed to bind for clientaddr: %d %s\n", | ||
38 | + errno, strerror(errno))); | ||
39 | + netsnmp_socketbase_close(t); | ||
40 | + netsnmp_transport_free(t); | ||
41 | + } | ||
42 | + } | ||
43 | /* | ||
44 | * This is a client session. Save the address in the | ||
45 | * transport-specific data pointer for later use by netsnmp_udp6_send. | ||
46 | -- | ||
47 | 2.9.3 | ||
48 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb index 1997d5cd0..140028722 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb | |||
@@ -24,6 +24,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ | |||
24 | file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \ | 24 | file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \ |
25 | file://net-snmp-agentx-crash.patch \ | 25 | file://net-snmp-agentx-crash.patch \ |
26 | file://0001-get_pid_from_inode-Include-limit.h.patch \ | 26 | file://0001-get_pid_from_inode-Include-limit.h.patch \ |
27 | file://0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch \ | ||
27 | " | 28 | " |
28 | SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee" | 29 | SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee" |
29 | SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e" | 30 | SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e" |