All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-networking][PATCH 1/2] net-snmp: fix snmptrap to use clientaddr from snmp.conf.
@ 2016-11-23  4:10 Li Zhou
  2016-11-23  4:10 ` [meta-networking][PATCH 2/2] net-snmp: snmplib, UDPIPv6 transport: Add a missing return statement Li Zhou
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zhou @ 2016-11-23  4:10 UTC (permalink / raw)
  To: openembedded-devel

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>
---
 ...ix-snmptrap-to-use-clientaddr-from-snmp.c.patch | 48 ++++++++++++++++++++++
 .../recipes-protocols/net-snmp/net-snmp_5.7.3.bb   |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch

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 0000000..b05eea5
--- /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
+
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 1997d5c..1400287 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 \
            file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \
            file://net-snmp-agentx-crash.patch \
            file://0001-get_pid_from_inode-Include-limit.h.patch \
+           file://0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch \
            "
 SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee"
 SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e"
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [meta-networking][PATCH 2/2] net-snmp: snmplib, UDPIPv6 transport: Add a missing return statement
  2016-11-23  4:10 [meta-networking][PATCH 1/2] net-snmp: fix snmptrap to use clientaddr from snmp.conf Li Zhou
@ 2016-11-23  4:10 ` Li Zhou
  0 siblings, 0 replies; 2+ messages in thread
From: Li Zhou @ 2016-11-23  4:10 UTC (permalink / raw)
  To: openembedded-devel

Backport a succeeding commit from net-snmp upstream to fix the issue
introduced by commit
<BUG#a2584: Fix snmptrap to use clientaddr from snmp.conf>.
The missing return will cause crash when binding to a non-exist IPv6
address.

Signed-off-by: Li Zhou <li.zhou@windriver.com>
---
 ...IPv6-transport-Add-a-missing-return-state.patch | 29 ++++++++++++++++++++++
 .../recipes-protocols/net-snmp/net-snmp_5.7.3.bb   |  1 +
 2 files changed, 30 insertions(+)
 create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch

diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch
new file mode 100644
index 0000000..6255f7c
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch
@@ -0,0 +1,29 @@
+From 1ee72102fbe722d232d74abc4660a8b134cec8d6 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Sat, 23 May 2015 07:32:53 +0200
+Subject: [PATCH] snmplib, UDPIPv6 transport: Add a missing return statement
+
+Detected by Coverity.
+
+Upstream-Status: backport
+
+Signed-off-by: Li Zhou <li.zhou@windriver.com>
+---
+ snmplib/transports/snmpUDPIPv6Domain.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
+index 029b164..11c39bb 100644
+--- a/snmplib/transports/snmpUDPIPv6Domain.c
++++ b/snmplib/transports/snmpUDPIPv6Domain.c
+@@ -285,6 +285,7 @@ netsnmp_udp6_transport(struct sockaddr_in6 *addr, int local)
+                                  errno, strerror(errno)));
+                 netsnmp_socketbase_close(t);
+                 netsnmp_transport_free(t);
++                return NULL;
+             }
+         }
+         /*
+-- 
+2.9.3
+
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 1400287..79e7766 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
@@ -25,6 +25,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
            file://net-snmp-agentx-crash.patch \
            file://0001-get_pid_from_inode-Include-limit.h.patch \
            file://0001-BUG-a2584-Fix-snmptrap-to-use-clientaddr-from-snmp.c.patch \
+           file://0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch \
            "
 SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee"
 SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e"
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-23  4:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23  4:10 [meta-networking][PATCH 1/2] net-snmp: fix snmptrap to use clientaddr from snmp.conf Li Zhou
2016-11-23  4:10 ` [meta-networking][PATCH 2/2] net-snmp: snmplib, UDPIPv6 transport: Add a missing return statement Li Zhou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.