aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2021-05-11 14:55:08 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2021-05-12 16:43:47 +0200
commitc5377d7bbdc158b9540ab5409a29adcdd9911c63 (patch)
treef8daf7493aafaef45876e374f7681d4a3dc45daa
parent1070ccb1a95cfd77ec77b660bf97729e2332eef3 (diff)
downloadaports-c5377d7bbdc158b9540ab5409a29adcdd9911c63.tar.gz
aports-c5377d7bbdc158b9540ab5409a29adcdd9911c63.tar.bz2
aports-c5377d7bbdc158b9540ab5409a29adcdd9911c63.tar.xz
main/net-snmp: backport ip parsing fix, enable -dbg
backport upstream fix
-rw-r--r--main/net-snmp/APKBUILD12
-rw-r--r--main/net-snmp/Prevent-parsing-IP-address-twice.patch47
2 files changed, 55 insertions, 4 deletions
diff --git a/main/net-snmp/APKBUILD b/main/net-snmp/APKBUILD
index a7691fb354..e4f0432961 100644
--- a/main/net-snmp/APKBUILD
+++ b/main/net-snmp/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=net-snmp
pkgver=5.9
-pkgrel=2
+pkgrel=3
pkgdesc="Simple Network Management Protocol"
url="http://www.net-snmp.org/"
arch="all"
@@ -12,11 +12,12 @@ depends_dev="openssl-dev"
# we need perl-net-snmp in make depends for bootstrapping issues
# net-snmp-gui subpackage has perl-net-snmp as depends
makedepends="file perl-dev openssl-dev perl-net-snmp linux-headers"
-subpackages="$pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
+subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-libs $pkgname-agent-libs:alibs
$pkgname-perl:pl $pkgname-gui $pkgname-tools $pkgname-openrc"
source="https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
netsnmp-swinst-crash.patch
fix-includes.patch
+ Prevent-parsing-IP-address-twice.patch
snmpd.initd
snmpd.confd
@@ -142,9 +143,12 @@ tools() {
mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}
-sha512sums="df3273f03065ea5cb7d63398308ada06bcd186e0bc48929e81ba647f392b646ab81ddc241aebcd75408ec29231377375af62edf2835e9c3eb01d0a6856b79434 net-snmp-5.9.tar.gz
+sha512sums="
+df3273f03065ea5cb7d63398308ada06bcd186e0bc48929e81ba647f392b646ab81ddc241aebcd75408ec29231377375af62edf2835e9c3eb01d0a6856b79434 net-snmp-5.9.tar.gz
4ad92f50b14d5e27ba86256cc532a2dd055502f4d5fbb1700434f9f01f881fd09bb1eadb94e727554e1470f036707558314c64a66d0376b54e71ab31d5e4baa3 netsnmp-swinst-crash.patch
87a552bd2e41684bba6e87fbcf6454a85ee912d7a339411fda24cebddf7661f0856729e076a917920a542cf84b687ffd90a091daa15f2c48f0ff64f3a53c0ddb fix-includes.patch
+0a2d255019292e8d7780fe629e418def5a3e2f2807796567d0c25e6217257f2d51f289414e87f8ac2d3bc70c4019c0815e61a27c55fc00476bf46d23d30b68d9 Prevent-parsing-IP-address-twice.patch
896ef65a6f420073746470cdbd0de8f356c5b936d35e131754905b3d4323c24dcd3a09e0cc8bd90b12e3402f01e478f927f0e4163cb85cb0cc03db3c2e0491f4 snmpd.initd
fb101aa758d741ed3ea88b11f1cd49cfd04bd03ce62435f3acb17724748131c57f00b71fd45cb7e7871d65a1aab576652cd6e158b6406aa6d0998582b8235ef5 snmpd.confd
-073fd2b83eedd6eda1f7345350268ce7946ef6d67a8f26f7c232e46feb75babf68272ae12071a2f9ea76ede71393b3ae4672d3cd47cfd14ab77e3a6482f2e124 snmptrapd.confd"
+073fd2b83eedd6eda1f7345350268ce7946ef6d67a8f26f7c232e46feb75babf68272ae12071a2f9ea76ede71393b3ae4672d3cd47cfd14ab77e3a6482f2e124 snmptrapd.confd
+"
diff --git a/main/net-snmp/Prevent-parsing-IP-address-twice.patch b/main/net-snmp/Prevent-parsing-IP-address-twice.patch
new file mode 100644
index 0000000000..0de70c1d8c
--- /dev/null
+++ b/main/net-snmp/Prevent-parsing-IP-address-twice.patch
@@ -0,0 +1,47 @@
+From eb1b11bb7f3ac3281dc6e92d94e8fa749cac44e0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= <jridky@redhat.com>
+Date: Fri, 12 Mar 2021 10:15:30 +0100
+Subject: [PATCH] Prevent parsing IP address twice (#199)
+
+This fixes issue, that is caused by parsing IP address twice.
+First as IPv4 and as IPv6 at second, even thow the address was
+properly parsed as a valid IPv4 address.
+---
+ snmplib/transports/snmpUDPDomain.c | 2 +-
+ snmplib/transports/snmpUDPIPv6Domain.c | 10 +++++++++-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/snmplib/transports/snmpUDPDomain.c b/snmplib/transports/snmpUDPDomain.c
+index 46c818753..eea5840d0 100644
+--- a/snmplib/transports/snmpUDPDomain.c
++++ b/snmplib/transports/snmpUDPDomain.c
+@@ -386,7 +386,7 @@ netsnmp_udp_parse_security(const char *token, char *param)
+ /* Nope, wasn't a dotted quad. Must be a hostname. */
+ int ret = netsnmp_gethostbyname_v4(sourcep, &network.s_addr);
+ if (ret < 0) {
+- config_perror("cannot resolve source hostname");
++ config_perror("cannot resolve IPv4 source hostname");
+ return;
+ }
+ }
+diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
+index a6ee2dec3..e612bf2de 100644
+--- a/snmplib/transports/snmpUDPIPv6Domain.c
++++ b/snmplib/transports/snmpUDPIPv6Domain.c
+@@ -735,7 +735,15 @@ netsnmp_udp6_parse_security(const char *token, char *param)
+ memset(&pton_addr.sin6_addr.s6_addr, '\0',
+ sizeof(struct in6_addr));
+ } else if (inet_pton(AF_INET6, sourcep, &pton_addr.sin6_addr) != 1) {
+- /* Nope, wasn't a numeric address. Must be a hostname. */
++ /* Nope, wasn't a numeric IPv6 address. Must be IPv4 or a hostname. */
++
++ /* Try interpreting as dotted quad - IPv4 */
++ struct in_addr network;
++ if (inet_pton(AF_INET, sourcep, &network) > 0){
++ /* Yes, it's IPv4 - so it's already parsed and we can return. */
++ DEBUGMSGTL(("com2sec6", "IPv4 detected for IPv6 parser. Skipping.\n"));
++ return;
++ }
+ #if HAVE_GETADDRINFO
+ int gai_error;
+