net-snmp: upgrade 5.7.3 -> 5.8

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Changqing Li
2018-08-09 13:16:46 +08:00
committed by Khem Raj
parent 576515a07c
commit 03bd258021
19 changed files with 68 additions and 3306 deletions
@@ -1,45 +0,0 @@
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(+)
Index: net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
===================================================================
--- net-snmp-5.7.3.orig/snmplib/transports/snmpUDPIPv6Domain.c
+++ net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
@@ -286,6 +286,27 @@ netsnmp_udp6_transport(struct sockaddr_i
return NULL;
#endif /* NETSNMP_NO_LISTEN_SUPPORT */
} 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.
@@ -1,4 +1,4 @@
From 261a22096c79f8e6ef7b387514a74d208e4e5945 Mon Sep 17 00:00:00 2001
From 7ae2ce8dbf1c54d4e2db4a5f49397a239baadc49 Mon Sep 17 00:00:00 2001
From: Li xin <lixin.fnst@cn.fujitsu.com>
Date: Fri, 21 Aug 2015 18:23:13 +0900
Subject: [PATCH] config_os_headers: Error Fix
@@ -13,15 +13,16 @@ conftest.c:168:17: fatal error: pkg.h: No such file or directory
Upstream-Status: pending
Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
---
configure.d/config_os_headers | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: net-snmp-5.7.3/configure.d/config_os_headers
===================================================================
--- net-snmp-5.7.3.orig/configure.d/config_os_headers
+++ net-snmp-5.7.3/configure.d/config_os_headers
@@ -484,8 +484,8 @@ then
diff --git a/configure.d/config_os_headers b/configure.d/config_os_headers
index af99746..83b2e31 100644
--- a/configure.d/config_os_headers
+++ b/configure.d/config_os_headers
@@ -489,8 +489,8 @@ then
unset ac_cv_header_pkg_h
netsnmp_save_CPPFLAGS="$CPPFLAGS"
netsnmp_save_LDFLAGS="$LDFLAGS"
@@ -1,31 +0,0 @@
From e24fcd140f3f6dd18fd836b197c6d4bb773e50e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <funman@videolan.org>
Date: Wed, 4 Nov 2015 16:49:30 +0100
Subject: [PATCH] config_os_libs2: Error Fix
ERROR: This autoconf log indicates errors, it looked at host include
and/or library paths while determining system capabilities.
---
configure.d/config_os_libs2 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2
index 47491e2..e3647f9 100644
--- a/configure.d/config_os_libs2
+++ b/configure.d/config_os_libs2
@@ -226,10 +226,10 @@ if test "x$with_nl" != "xno"; then
case $target_os in
linux*) # Check for libnl (linux)
netsnmp_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="-I/usr/include/libnl3 $CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS"
NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
[AC_CHECK_HEADERS(netlink/netlink.h)
- EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES -I/usr/include/libnl3"],
+ EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES"],
[CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [], [LMIBLIBS])
if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
NETSNMP_SEARCH_LIBS(nl_connect, nl, [
--
2.5.0
@@ -1,31 +0,0 @@
From c6304a3e4b8441ff0a6464c0f1f6c5229092fa32 Mon Sep 17 00:00:00 2001
From: Niels Baggesen <nba@users.sourceforge.net>
Date: Wed, 24 May 2017 16:40:03 +0800
Subject: [PATCH 1/4] configure: fix check for --enable-perl-cc-checks
This patch comes from git://git.code.sf.net/p/net-snmp/code,
the commit is 8f431d410b803603dc809d82e0893509615d9a11.
Upstream-Status: Backport
Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
---
configure.d/config_project_perl_python | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.d/config_project_perl_python b/configure.d/config_project_perl_python
index 23f8c7e..475c843 100644
--- a/configure.d/config_project_perl_python
+++ b/configure.d/config_project_perl_python
@@ -84,7 +84,7 @@ if test "x$install_perl" != "xno" ; then
# What compiler was used to build the perl binary?
#
- if test "xenable_perl_cc_checks" != "xno" ; then
+ if test "x$enable_perl_cc_checks" != "xno" ; then
AC_MSG_CHECKING([for Perl cc])
changequote(, )
PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'`
--
1.9.1
@@ -1,22 +1,23 @@
From 7136d593ba96b64537069637c328bc65e1b66b2d Mon Sep 17 00:00:00 2001
From 98c6edba4835b515d933542411d80879327eee16 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 22 Jul 2016 18:34:39 +0000
Subject: [PATCH] get_pid_from_inode: Include limit.h
PATH_MAX and NAME_MAX are required by this file
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
agent/mibgroup/util_funcs/get_pid_from_inode.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/agent/mibgroup/util_funcs/get_pid_from_inode.c b/agent/mibgroup/util_funcs/get_pid_from_inode.c
index 8e157ae..a494ec7 100644
index aee907d..7abaec2 100644
--- a/agent/mibgroup/util_funcs/get_pid_from_inode.c
+++ b/agent/mibgroup/util_funcs/get_pid_from_inode.c
@@ -5,6 +5,7 @@
@@ -6,6 +6,7 @@
#include <net-snmp/output_api.h>
#include <ctype.h>
@@ -24,6 +25,3 @@ index 8e157ae..a494ec7 100644
#include <stdio.h>
#if HAVE_STDLIB_H
#include <stdlib.h>
--
1.8.3.1
@@ -1,26 +0,0 @@
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(+)
Index: net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
===================================================================
--- net-snmp-5.7.3.orig/snmplib/transports/snmpUDPIPv6Domain.c
+++ net-snmp-5.7.3/snmplib/transports/snmpUDPIPv6Domain.c
@@ -305,6 +305,7 @@ netsnmp_udp6_transport(struct sockaddr_i
errno, strerror(errno)));
netsnmp_socketbase_close(t);
netsnmp_transport_free(t);
+ return NULL;
}
}
/*
@@ -1,7 +1,8 @@
From d3027a227bc0f603a5b650d01f97ee1dec515be5 Mon Sep 17 00:00:00 2001
From 89538a973119f1bf976b3a6df157ea940cf32eb5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 18 Sep 2015 00:28:45 -0400
Subject: [PATCH] snmplib/keytools.c: Don't check for return from
EVP_MD_CTX_init()
EVP_MD_CTX_init() API returns void, it fixes errors with new compilers
@@ -9,16 +10,16 @@ EVP_MD_CTX_init() API returns void, it fixes errors with new compilers
snmplib/keytools.c: In function 'generate_Ku': error: invalid use of void expression
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Submitted [https://sourceforge.net/p/net-snmp/patches/1317/]
snmplib/keytools.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/snmplib/keytools.c b/snmplib/keytools.c
index 0ccb3a6..880fc14 100644
index 2cf0240..50fd3ea 100644
--- a/snmplib/keytools.c
+++ b/snmplib/keytools.c
@@ -153,8 +153,7 @@ generate_Ku(const oid * hashtype, u_int hashtype_len,
@@ -186,8 +186,7 @@ generate_Ku(const oid * hashtype, u_int hashtype_len,
ctx = EVP_MD_CTX_create();
#else
ctx = malloc(sizeof(*ctx));
@@ -26,8 +27,5 @@ index 0ccb3a6..880fc14 100644
- return SNMPERR_GENERR;
+ EVP_MD_CTX_init(ctx);
#endif
#ifndef NETSNMP_DISABLE_MD5
if (ISTRANSFORM(hashtype, HMACMD5Auth)) {
--
2.5.2
if (!EVP_DigestInit(ctx, hashfn))
return SNMPERR_GENERR;
@@ -1,4 +1,4 @@
From 94e7e4969bc84c945dfea12d67a1e10f61973948 Mon Sep 17 00:00:00 2001
From a3631df3d6743113e1cd63579925e15bcce85868 Mon Sep 17 00:00:00 2001
From: Wenlin Kang <wenlin.kang@windriver.com>
Date: Wed, 24 May 2017 16:45:34 +0800
Subject: [PATCH 2/4] configure: fix a cc check issue.
@@ -8,6 +8,7 @@ $myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'
can't get corretly the cc's value.
Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
---
configure.d/config_project_perl_python | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -25,6 +26,3 @@ index 475c843..22d2ad3 100644
changequote([, ])
if test "x$PERLCC" != "x" ; then
AC_MSG_RESULT([$PERLCC])
--
1.9.1
@@ -1,186 +0,0 @@
From e57fc809ad6ae522670f3dc157aadde20d968ca7 Mon Sep 17 00:00:00 2001
From: Bart Van Assche <bvanassche@acm.org>
Date: Wed, 24 May 2017 17:05:03 +0800
Subject: [PATCH 3/4] CHANGES: BUG: 2712: Fix Perl module compilation
Avoid that building the Net-SNMP Perl modules fails as follows:
ERROR from evaluation of /sources/net-snmp-5.7.3/perl/ASN/Makefile.PL: Bizarre \ copy of HASH in list assignment at /usr/lib/perl5/site_perl/5.24.0/Carp.pm line\ 229.
See also https://sourceforge.net/p/net-snmp/bugs/2712/.
This patch comes from git://git.code.sf.net/p/net-snmp/code,
the commit is 4e793461e96a2b4fd81142ab312d074d5c8841fa.
Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
---
perl/ASN/Makefile.PL | 4 +---
perl/Makefile.PL | 4 +---
perl/OID/Makefile.PL | 5 +----
perl/SNMP/Makefile.PL | 5 +----
perl/TrapReceiver/Makefile.PL | 5 +----
perl/agent/Makefile.PL | 5 +----
perl/agent/Support/Makefile.PL | 5 +----
perl/agent/default_store/Makefile.PL | 5 +----
perl/default_store/Makefile.PL | 5 +----
9 files changed, 9 insertions(+), 34 deletions(-)
diff --git a/perl/ASN/Makefile.PL b/perl/ASN/Makefile.PL
index 4576781..c33d8ba 100644
--- a/perl/ASN/Makefile.PL
+++ b/perl/ASN/Makefile.PL
@@ -7,9 +7,7 @@ my $lib_version;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
Check_Version();
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 31fdc40..48aba2a 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -3,9 +3,7 @@ use Config;
use Getopt::Long;
require 5;
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
sub InitMakeParams {
$nsconfig="net-snmp-config"; # in path by default
diff --git a/perl/OID/Makefile.PL b/perl/OID/Makefile.PL
index 6bb1616..2589985 100644
--- a/perl/OID/Makefile.PL
+++ b/perl/OID/Makefile.PL
@@ -6,11 +6,8 @@ require 5;
use Config;
use Getopt::Long;
my $lib_version;
-my %MakeParams = ();
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
Check_Version();
diff --git a/perl/SNMP/Makefile.PL b/perl/SNMP/Makefile.PL
index e617cb7..8aab9a9 100644
--- a/perl/SNMP/Makefile.PL
+++ b/perl/SNMP/Makefile.PL
@@ -3,15 +3,12 @@ require 5;
use Config;
use Getopt::Long;
my $lib_version;
-my %MakeParams = ();
my $opts;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
Check_Version();
diff --git a/perl/TrapReceiver/Makefile.PL b/perl/TrapReceiver/Makefile.PL
index 874ee21..7e9e58e 100644
--- a/perl/TrapReceiver/Makefile.PL
+++ b/perl/TrapReceiver/Makefile.PL
@@ -3,11 +3,8 @@ require 5;
use Config;
use Getopt::Long;
my $lib_version;
-my %MakeParams = ();
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
Check_Version();
diff --git a/perl/agent/Makefile.PL b/perl/agent/Makefile.PL
index 4f7bee3..003c0d1 100644
--- a/perl/agent/Makefile.PL
+++ b/perl/agent/Makefile.PL
@@ -3,11 +3,8 @@ require 5;
use Config;
use Getopt::Long;
my $lib_version;
-my %MakeParams = ();
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
Check_Version();
diff --git a/perl/agent/Support/Makefile.PL b/perl/agent/Support/Makefile.PL
index 48815b6..2325e10 100644
--- a/perl/agent/Support/Makefile.PL
+++ b/perl/agent/Support/Makefile.PL
@@ -3,14 +3,11 @@ require 5;
use Config;
use Getopt::Long;
my $lib_version;
-my %MakeParams = ();
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
Check_Version();
diff --git a/perl/agent/default_store/Makefile.PL b/perl/agent/default_store/Makefile.PL
index ed6483a..31cfbee 100644
--- a/perl/agent/default_store/Makefile.PL
+++ b/perl/agent/default_store/Makefile.PL
@@ -3,11 +3,8 @@ require 5;
use Config;
use Getopt::Long;
my $lib_version;
-my %MakeParams = ();
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
Check_Version();
diff --git a/perl/default_store/Makefile.PL b/perl/default_store/Makefile.PL
index 7c671b8..01c8dd0 100644
--- a/perl/default_store/Makefile.PL
+++ b/perl/default_store/Makefile.PL
@@ -3,11 +3,8 @@ require 5;
use Config;
use Getopt::Long;
my $lib_version;
-my %MakeParams = ();
-%MakeParams = InitMakeParams();
-
-WriteMakefile(%MakeParams);
+WriteMakefile(InitMakeParams());
sub InitMakeParams {
--
1.9.1
@@ -1,4 +1,4 @@
From 4ad98ef125eb4e7d7a1a93146042002f78254d36 Mon Sep 17 00:00:00 2001
From f3c5cd4df7ce8e5639c99b7b918e41fb89e969e3 Mon Sep 17 00:00:00 2001
From: Wenlin Kang <wenlin.kang@windriver.com>
Date: Wed, 24 May 2017 17:10:20 +0800
Subject: [PATCH 4/4] configure: fix incorrect variable
@@ -8,15 +8,16 @@ For cross compile platform, this variable will not be correct, so fix it.
Upstream-Status: Inappropriate [cross compile specific]
Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
---
Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index cfcdf73..164df05 100644
index 9dbdde1..5fdc760 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -171,7 +171,7 @@ OTHERCLEANTODOS=perlclean @PYTHONCLEANTARGS@ cleanfeatures perlcleanfeatures pyt
@@ -173,7 +173,7 @@ OTHERCLEANTODOS=perlclean @PYTHONCLEANTARGS@ cleanfeatures perlcleanfeatures pyt
#
# override LD_RUN_PATH to avoid dependencies on the build directory
perlmodules: perlmakefiles subdirs
@@ -25,6 +26,3 @@ index cfcdf73..164df05 100644
if test $$? != 0 ; then \
exit 1 ; \
fi
--
1.9.1
@@ -1,131 +0,0 @@
From 6b93e686bdb6a908d00595608646a05527a5326b Mon Sep 17 00:00:00 2001
From: Li xin <lixin.fnst@cn.fujitsu.com>
Date: Fri, 21 Aug 2015 12:39:12 +0900
Subject: [PATCH] the snmp_pdu_parse() function could leave incompletely parsed
varBind variables in the list of variables in case the parsing of the SNMP
PDU failed. If later processing tries to operate on the stale and
incompletely processed varBind (e.g. when printing the variables), this can
lead to e.g. crashes or, possibly, execution of arbitrary code
Upstream-Status: Backport [net-snmp]
Written-by: Robert Story
---
snmplib/snmp_api.c | 53 ++++++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/snmplib/snmp_api.c b/snmplib/snmp_api.c
index 191debf..15a2d39 100644
--- a/snmplib/snmp_api.c
+++ b/snmplib/snmp_api.c
@@ -4350,10 +4350,9 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
u_char type;
u_char msg_type;
u_char *var_val;
- int badtype = 0;
size_t len;
size_t four;
- netsnmp_variable_list *vp = NULL;
+ netsnmp_variable_list *vp = NULL, *vplast = NULL;
oid objid[MAX_OID_LEN];
u_char *p;
@@ -4493,31 +4492,17 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
(ASN_SEQUENCE | ASN_CONSTRUCTOR),
"varbinds");
if (data == NULL)
- return -1;
+ goto fail;
/*
* get each varBind sequence
*/
while ((int) *length > 0) {
- netsnmp_variable_list *vptemp;
- vptemp = (netsnmp_variable_list *) malloc(sizeof(*vptemp));
- if (NULL == vptemp) {
- return -1;
- }
- if (NULL == vp) {
- pdu->variables = vptemp;
- } else {
- vp->next_variable = vptemp;
- }
- vp = vptemp;
+ vp = SNMP_MALLOC_TYPEDEF(netsnmp_variable_list);
+ if (NULL == vp)
+ goto fail;
- vp->next_variable = NULL;
- vp->val.string = NULL;
vp->name_length = MAX_OID_LEN;
- vp->name = NULL;
- vp->index = 0;
- vp->data = NULL;
- vp->dataFreeHook = NULL;
DEBUGDUMPSECTION("recv", "VarBind");
data = snmp_parse_var_op(data, objid, &vp->name_length, &vp->type,
&vp->val_len, &var_val, length);
@@ -4604,7 +4589,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
vp->val.string = (u_char *) malloc(vp->val_len);
}
if (vp->val.string == NULL) {
- return -1;
+ goto fail;
}
p = asn_parse_string(var_val, &len, &vp->type, vp->val.string,
&vp->val_len);
@@ -4619,7 +4604,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
vp->val_len *= sizeof(oid);
vp->val.objid = (oid *) malloc(vp->val_len);
if (vp->val.objid == NULL) {
- return -1;
+ goto fail;
}
memmove(vp->val.objid, objid, vp->val_len);
break;
@@ -4631,7 +4616,7 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
case ASN_BIT_STR:
vp->val.bitstring = (u_char *) malloc(vp->val_len);
if (vp->val.bitstring == NULL) {
- return -1;
+ goto fail;
}
p = asn_parse_bitstring(var_val, &len, &vp->type,
vp->val.bitstring, &vp->val_len);
@@ -4640,12 +4625,30 @@ snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data, size_t * length)
break;
default:
snmp_log(LOG_ERR, "bad type returned (%x)\n", vp->type);
- badtype = -1;
+ goto fail;
break;
}
DEBUGINDENTADD(-4);
+
+ if (NULL == vplast) {
+ pdu->variables = vp;
+ } else {
+ vplast->next_variable = vp;
+ }
+ vplast = vp;
+ vp = NULL;
+
}
- return badtype;
+ return 0;
+
+ fail:
+ DEBUGMSGTL(("recv", "error while parsing VarBindList\n"));
+ /** if we were parsing a var, remove it from the pdu and free it */
+ if (vp)
+ snmp_free_var(vp);
+
+ return -1;
+
}
/*
--
1.8.4.2
@@ -1,3 +1,8 @@
From 0becb4843a40910d5ec9aa11969d4905a22037cf Mon Sep 17 00:00:00 2001
From: "Roy.Li" <rongqing.li@windriver.com>
Date: Fri, 16 Jan 2015 14:14:01 +0800
Subject: [PATCH] net-snmp: fix "libtool --finish"
LIB_LDCONFIG_CMD failed since it is using a host dir $(libdir)
which is /usr/lib64 does not exist on host when compile 64bit
image.
@@ -9,12 +14,16 @@ rpm-postinst for each recipe while do_package, in package.bbclass.
Upstream-Status: Inappropriate [cross compile specific]
Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
Index: net-snmp-5.7.3/Makefile.top
===================================================================
--- net-snmp-5.7.3.orig/Makefile.top
+++ net-snmp-5.7.3/Makefile.top
@@ -87,7 +87,7 @@ LIBREVISION = 3
Makefile.top | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.top b/Makefile.top
index 5d4f9bc..d0ed31c 100644
--- a/Makefile.top
+++ b/Makefile.top
@@ -89,7 +89,7 @@ LIBREVISION = 0
LIB_LD_CMD = $(LIBTOOL) --mode=link $(LINKCC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
LIB_EXTENSION = la
LIB_VERSION =
@@ -1,181 +0,0 @@
net-snmp build fails on Debian 9 with OpenSSL 1.1.0
With these changes, net-snmp builds with both
OpenSSL 1.0.x and 1.1.x.
Author: Sharmila Podury <sharmila.podury@brocade.com>
Index: net-snmp-5.7.3/apps/snmpusm.c
===================================================================
--- net-snmp-5.7.3.orig/apps/snmpusm.c
+++ net-snmp-5.7.3/apps/snmpusm.c
@@ -125,6 +125,32 @@ char *usmUserPublic_val = NULL
int docreateandwait = 0;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+
+#include <string.h>
+#include <openssl/engine.h>
+
+void DH_get0_pqg(const DH *dh,
+ const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
+{
+ if (p != NULL)
+ *p = dh->p;
+ if (q != NULL)
+ *q = dh->q;
+ if (g != NULL)
+ *g = dh->g;
+}
+
+void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
+{
+ if (pub_key != NULL)
+ *pub_key = dh->pub_key;
+ if (priv_key != NULL)
+ *priv_key = dh->priv_key;
+}
+
+#endif
+
void
usage(void)
{
@@ -190,7 +216,7 @@ get_USM_DH_key(netsnmp_variable_list *va
oid *keyoid, size_t keyoid_len) {
u_char *dhkeychange;
DH *dh;
- BIGNUM *other_pub;
+ BIGNUM *p, *g, *pub_key, *other_pub;
u_char *key;
size_t key_len;
@@ -205,25 +231,29 @@ get_USM_DH_key(netsnmp_variable_list *va
dh = d2i_DHparams(NULL, &cp, dhvar->val_len);
}
- if (!dh || !dh->g || !dh->p) {
+ if (dh)
+ DH_get0_pqg(dh, &p, NULL, &g);
+
+ if (!dh || !g || !p) {
SNMP_FREE(dhkeychange);
return SNMPERR_GENERR;
}
- DH_generate_key(dh);
- if (!dh->pub_key) {
+ if (!DH_generate_key(dh)) {
SNMP_FREE(dhkeychange);
return SNMPERR_GENERR;
}
- if (vars->val_len != (unsigned int)BN_num_bytes(dh->pub_key)) {
+ DH_get0_key(dh, &pub_key, NULL);
+
+ if (vars->val_len != (unsigned int)BN_num_bytes(pub_key)) {
SNMP_FREE(dhkeychange);
fprintf(stderr,"incorrect diffie-helman lengths (%lu != %d)\n",
- (unsigned long)vars->val_len, BN_num_bytes(dh->pub_key));
+ (unsigned long)vars->val_len, BN_num_bytes(pub_key));
return SNMPERR_GENERR;
}
- BN_bn2bin(dh->pub_key, dhkeychange + vars->val_len);
+ BN_bn2bin(pub_key, dhkeychange + vars->val_len);
key_len = DH_size(dh);
if (!key_len) {
Index: net-snmp-5.7.3/configure.d/config_os_libs2
===================================================================
--- net-snmp-5.7.3.orig/configure.d/config_os_libs2
+++ net-snmp-5.7.3/configure.d/config_os_libs2
@@ -293,10 +293,16 @@ if test "x$tryopenssl" != "xno" -a "x$tr
[Define to 1 if you have the `AES_cfb128_encrypt' function.]))
AC_CHECK_LIB(${CRYPTO}, EVP_MD_CTX_create,
- AC_DEFINE([HAVE_EVP_MD_CTX_CREATE], [],
+ AC_DEFINE([HAVE_EVP_MD_CTX_CREATE], [1],
[Define to 1 if you have the `EVP_MD_CTX_create' function.])
- AC_DEFINE([HAVE_EVP_MD_CTX_DESTROY], [],
+ AC_DEFINE([HAVE_EVP_MD_CTX_DESTROY], [1],
[Define to 1 if you have the `EVP_MD_CTX_destroy' function.]))
+
+ AC_CHECK_LIB(${CRYPTO}, EVP_MD_CTX_new,
+ AC_DEFINE([HAVE_EVP_MD_CTX_NEW], [1],
+ [Define to 1 if you have the `EVP_MD_CTX_new' function.])
+ AC_DEFINE([HAVE_EVP_MD_CTX_FREE], [1],
+ [Define to 1 if you have the `EVP_MD_CTX_free' function.]))
fi
if echo " $transport_result_list " | $GREP "DTLS" > /dev/null; then
AC_CHECK_LIB(ssl, DTLSv1_method,
Index: net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in
===================================================================
--- net-snmp-5.7.3.orig/include/net-snmp/net-snmp-config.h.in
+++ net-snmp-5.7.3/include/net-snmp/net-snmp-config.h.in
@@ -155,6 +155,12 @@
/* Define to 1 if you have the `EVP_MD_CTX_destroy' function. */
#undef HAVE_EVP_MD_CTX_DESTROY
+/* Define to 1 if you have the `EVP_MD_CTX_free' function. */
+#undef HAVE_EVP_MD_CTX_FREE
+
+/* Define to 1 if you have the `EVP_MD_CTX_new' function. */
+#undef HAVE_EVP_MD_CTX_NEW
+
/* Define if you have EVP_sha224/256 in openssl */
#undef HAVE_EVP_SHA224
Index: net-snmp-5.7.3/snmplib/keytools.c
===================================================================
--- net-snmp-5.7.3.orig/snmplib/keytools.c
+++ net-snmp-5.7.3/snmplib/keytools.c
@@ -149,7 +149,9 @@ generate_Ku(const oid * hashtype, u_int
*/
#ifdef NETSNMP_USE_OPENSSL
-#ifdef HAVE_EVP_MD_CTX_CREATE
+#ifdef HAVE_EVP_MD_CTX_NEW
+ ctx = EVP_MD_CTX_new();
+#elif HAVE_EVP_MD_CTX_CREATE
ctx = EVP_MD_CTX_create();
#else
ctx = malloc(sizeof(*ctx));
@@ -258,7 +260,9 @@ generate_Ku(const oid * hashtype, u_int
memset(buf, 0, sizeof(buf));
#ifdef NETSNMP_USE_OPENSSL
if (ctx) {
-#ifdef HAVE_EVP_MD_CTX_DESTROY
+#ifdef HAVE_EVP_MD_CTX_FREE
+ EVP_MD_CTX_free(ctx);
+#elif HAVE_EVP_MD_CTX_DESTROY
EVP_MD_CTX_destroy(ctx);
#else
EVP_MD_CTX_cleanup(ctx);
Index: net-snmp-5.7.3/snmplib/scapi.c
===================================================================
--- net-snmp-5.7.3.orig/snmplib/scapi.c
+++ net-snmp-5.7.3/snmplib/scapi.c
@@ -488,7 +488,9 @@ sc_hash(const oid * hashtype, size_t has
}
/** initialize the pointer */
-#ifdef HAVE_EVP_MD_CTX_CREATE
+#ifdef HAVE_EVP_MD_CTX_NEW
+ cptr = EVP_MD_CTX_new();
+#elif HAVE_EVP_MD_CTX_CREATE
cptr = EVP_MD_CTX_create();
#else
cptr = malloc(sizeof(*cptr));
@@ -509,7 +511,9 @@ sc_hash(const oid * hashtype, size_t has
/** do the final pass */
EVP_DigestFinal(cptr, MAC, &tmp_len);
*MAC_len = tmp_len;
-#ifdef HAVE_EVP_MD_CTX_DESTROY
+#ifdef HAVE_EVP_MD_CTX_FREE
+ EVP_MD_CTX_free(cptr);
+#elif HAVE_EVP_MD_CTX_DESTROY
EVP_MD_CTX_destroy(cptr);
#else
#if !defined(OLD_DES)
@@ -1,4 +1,4 @@
From e47c60dc7f649959f63e56bc62355de4bdfd73f4 Mon Sep 17 00:00:00 2001
From d619cd9fc01f336ff0ff55b18f9112789eb4d84c Mon Sep 17 00:00:00 2001
From: Marian Florea <marian.florea@windriver.com>
Date: Thu, 20 Jul 2017 16:55:24 +0800
Subject: [PATCH] net snmp: fix engineBoots value on SIGHUP
@@ -7,16 +7,17 @@ Upstream-Status: Pending
Signed-off-by: Marian Florea <marian.florea@windriver.com>
Signed-off-by: Li Zhou <li.zhou@windriver.com>
---
agent/snmpd.c | 1 +
snmplib/snmpv3.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
Index: net-snmp-5.7.3/agent/snmpd.c
===================================================================
--- net-snmp-5.7.3.orig/agent/snmpd.c
+++ net-snmp-5.7.3/agent/snmpd.c
@@ -1253,6 +1253,7 @@ receive(void)
diff --git a/agent/snmpd.c b/agent/snmpd.c
index 6566354..eb0d4b4 100644
--- a/agent/snmpd.c
+++ b/agent/snmpd.c
@@ -1239,6 +1239,7 @@ receive(void)
snmp_log(LOG_INFO, "NET-SNMP version %s restarted\n",
netsnmp_get_version());
update_config();
@@ -24,11 +25,11 @@ Index: net-snmp-5.7.3/agent/snmpd.c
send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 3);
#if HAVE_SIGHOLD
sigrelse(SIGHUP);
Index: net-snmp-5.7.3/snmplib/snmpv3.c
===================================================================
--- net-snmp-5.7.3.orig/snmplib/snmpv3.c
+++ net-snmp-5.7.3/snmplib/snmpv3.c
@@ -984,9 +984,9 @@ init_snmpv3_post_config(int majorid, int
diff --git a/snmplib/snmpv3.c b/snmplib/snmpv3.c
index 771ba3b..5de05e7 100644
--- a/snmplib/snmpv3.c
+++ b/snmplib/snmpv3.c
@@ -1060,9 +1060,9 @@ init_snmpv3_post_config(int majorid, int minorid, void *serverarg,
/*
* if our engineID has changed at all, the boots record must be set to 1
*/
@@ -1,75 +0,0 @@
Description: fix snmpd crash via AgentX connection
taken from Fedora, net-snmp-5.7-agentx-crash.patch
bz729738 - net-snmp dumps core in netsnmp_oid_find_prefix
bz1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out
commit f9304c83f76202db0e684269ca1af32e43cd9db4
Author: Jan Safranek <jsafranek@users.sourceforge.net>
Date: Tue Feb 7 14:53:44 2012 +0100
CHANGES: PATCH 1633670: fixed snmpd crashing when an AgentX subagent
disconnect in the middle of processing of a request.
I fixed also the memory leak reported in the tracker comments.
Upstream-Status: Backport
Signed-off-by: Zhu Yanjun <yanjun.zhu@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
agent/mibgroup/agentx/master.c | 5 +++++
agent/mibgroup/agentx/master_admin.c | 9 +++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c
index c42a42a..baeebaf 100644
--- a/agent/mibgroup/agentx/master.c
+++ b/agent/mibgroup/agentx/master.c
@@ -219,6 +219,9 @@ agentx_got_response(int operation,
if (!cache) {
DEBUGMSGTL(("agentx/master", "response too late on session %8p\n",
session));
+ /* response is too late, free the cache */
+ if (magic)
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic);
return 0;
}
requests = cache->requests;
@@ -606,6 +609,8 @@ agentx_master_handler(netsnmp_mib_handler *handler,
result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
if (result == 0) {
snmp_free_pdu(pdu);
+ if (cb_data)
+ netsnmp_free_delegated_cache((netsnmp_delegated_cache*) cb_data);
}
return SNMP_ERR_NOERROR;
diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c
index f16f392..b84b85e 100644
--- a/agent/mibgroup/agentx/master_admin.c
+++ b/agent/mibgroup/agentx/master_admin.c
@@ -133,11 +133,16 @@ close_agentx_session(netsnmp_session * session, int sessid)
* requests, so that the delegated request will be completed and
* further requests can be processed
*/
- netsnmp_remove_delegated_requests_for_session(session);
+ while (netsnmp_remove_delegated_requests_for_session(session)) {
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated reqests\n"));
+ }
+
if (session->subsession != NULL) {
netsnmp_session *subsession = session->subsession;
for(; subsession; subsession = subsession->next) {
- netsnmp_remove_delegated_requests_for_session(subsession);
+ while (netsnmp_remove_delegated_requests_for_session(subsession)) {
+ DEBUGMSGTL(("agentx/master", "Continue removing delegated subsession reqests\n"));
+ }
}
}
--
2.7.4
@@ -1,4 +1,4 @@
From 270e952f58a7e5ddeabe5a15e3ddaaadf40017d0 Mon Sep 17 00:00:00 2001
From 068952c0e0cdda5a91250b91c5fcc9b85b43daab Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Thu, 22 Jun 2017 10:25:08 +0800
Subject: [PATCH] net-snmp: fix for --disable-des
@@ -9,15 +9,16 @@ the --disable-des works correctly.
Upstream-Status: Submitted [net-snmp-coders@lists.sourceforge.net]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
snmplib/scapi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/snmplib/scapi.c b/snmplib/scapi.c
index 16ac829..271684b 100644
index 8ad1d70..43caddf 100644
--- a/snmplib/scapi.c
+++ b/snmplib/scapi.c
@@ -79,7 +79,9 @@ netsnmp_feature_child_of(usm_scapi, usm_support)
@@ -84,7 +84,9 @@ netsnmp_feature_child_of(usm_scapi, usm_support)
#include <openssl/hmac.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
@@ -27,6 +28,3 @@ index 16ac829..271684b 100644
#ifdef HAVE_AES
#include <openssl/aes.h>
#endif
--
2.11.0
@@ -1,4 +1,4 @@
From 4bb4024b395f19d36ab3569e2773ea80d8cc5261 Mon Sep 17 00:00:00 2001
From 827fe3b0253aab33472828f40ad05934cc0261b8 Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Wed, 14 Jan 2015 15:10:06 +0800
Subject: [PATCH] testing: add the output format for ptest
@@ -6,15 +6,16 @@ Subject: [PATCH] testing: add the output format for ptest
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
testing/RUNTESTS | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
Index: net-snmp-5.7.3/testing/RUNTESTS
===================================================================
--- net-snmp-5.7.3.orig/testing/RUNTESTS
+++ net-snmp-5.7.3/testing/RUNTESTS
@@ -29,13 +29,17 @@ failed_count=0
---
testing/RUNTESTS | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/testing/RUNTESTS b/testing/RUNTESTS
index 6715831..a2b6fb8 100755
--- a/testing/RUNTESTS
+++ b/testing/RUNTESTS
@@ -17,13 +17,17 @@ failed_count=0
rm -f failed_tests
for i in "${srcdir}"/testing/fulltests/default/T*$1*; do
echo "RUNNING $i"
@@ -11,32 +11,22 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \
file://init \
file://snmpd.conf \
file://snmptrapd.conf \
file://systemd-support.patch \
file://snmpd.service \
file://snmptrapd.service \
file://net-snmp-add-knob-whether-nlist.h-are-checked.patch \
file://fix-libtool-finish.patch \
file://net-snmp-testing-add-the-output-format-for-ptest.patch \
file://run-ptest \
file://dont-return-incompletely-parsed-varbinds.patch \
file://0001-config_os_headers-Error-Fix.patch \
file://0001-config_os_libs2-Error-Fix.patch \
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 \
file://0001-snmplib-UDPIPv6-transport-Add-a-missing-return-state.patch \
file://0001-configure-fix-check-for-enable-perl-cc-checks.patch \
file://0002-configure-fix-a-cc-check-issue.patch \
file://0003-CHANGES-BUG-2712-Fix-Perl-module-compilation.patch \
file://0004-configure-fix-incorrect-variable.patch \
file://net-snmp-5.7.2-fix-engineBoots-value-on-SIGHUP.patch \
file://net-snmp-fix-for-disable-des.patch \
file://0001-Remove-U64-typedef.patch \
file://fix-openssl-build-errors.patch \
"
SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee"
SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e"
SRC_URI[md5sum] = "6aae5948df7efde626613d6a4b3cd9d4"
SRC_URI[sha256sum] = "c6291385b8ed84f05890fe4197005daf7e7ee7b082c2e390fa114a9477a56042"
UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/net-snmp/files/net-snmp/"
UPSTREAM_CHECK_REGEX = "/net-snmp/(?P<pver>\d+(\.\d+)+)/"