diff --git a/SOURCES/0001-ecp-allow-for-failure-to-create.patch b/SOURCES/0001-ecp-allow-for-failure-to-create.patch new file mode 100644 index 0000000..20eca6b --- /dev/null +++ b/SOURCES/0001-ecp-allow-for-failure-to-create.patch @@ -0,0 +1,34 @@ +From e00392c7b4fa1e1fa447c6e3c930a06263629e98 Mon Sep 17 00:00:00 2001 +From: Aaron Conole +Date: Wed, 31 Jul 2019 16:07:03 -0400 +Subject: [PATCH] ecp: allow for failure to create + +Sometimes when trying to create an ecp instance for an interface, the +interface information becomes invalid, or isn't available in a consumable +form. This results in a null pointer being returned but the ecp create +routine can also return NULL. The null condition from ecp_create isn't +checked which leads to SEGV. + +Signed-off-by: Aaron Conole +--- + qbg/ecp22.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/qbg/ecp22.c b/qbg/ecp22.c +index 90b87fe..6561d14 100644 +--- a/qbg/ecp22.c ++++ b/qbg/ecp22.c +@@ -782,6 +782,10 @@ void ecp22_start(char *ifname) + ecp = find_ecpdata(ifname, eud); + if (!ecp) + ecp = ecp22_create(ifname, eud); ++ if (!ecp) { ++ LLDPAD_DBG("%s:%s failed creating ECP22 instance\n", __func__, ifname); ++ return; ++ } + ecp->max_retries = ECP22_MAX_RETRIES_DEFAULT; + ecp->max_rte = ECP22_ACK_TIMER_DEFAULT; + LIST_INIT(&ecp->inuse.head); +-- +2.21.0 + diff --git a/SOURCES/0001-l2_packet-Guard-ETH_P_LLDP-define.patch b/SOURCES/0001-l2_packet-Guard-ETH_P_LLDP-define.patch new file mode 100644 index 0000000..5e6afe2 --- /dev/null +++ b/SOURCES/0001-l2_packet-Guard-ETH_P_LLDP-define.patch @@ -0,0 +1,30 @@ +From 273caec484cd37c3d96b40b1754ef4c63b530eff Mon Sep 17 00:00:00 2001 +From: Scott Register +Date: Tue, 22 Oct 2019 09:11:06 -0700 +Subject: [PATCH] l2_packet: Guard ETH_P_LLDP define + +ETH_P_LLDP is now defined in if_ether.h on new kernels. Guarding this prevents +double definition when building on 5.3 kernels. + +Signed-off-by: Scott Register +--- + lldp/l2_packet.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lldp/l2_packet.h b/lldp/l2_packet.h +index b82b894..607b8a3 100644 +--- a/lldp/l2_packet.h ++++ b/lldp/l2_packet.h +@@ -37,7 +37,9 @@ + #define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] + #define IPSTR "%02x:%02x:%02x:%02x:%02x:%02x" + ++#ifndef ETH_P_LLDP + #define ETH_P_LLDP 0x88cc ++#endif + + #define ETH_P_ECP 0x88b7 /* Draft 0.2 */ + #define ETH_P_ECP22 0x8940 /* Ratified standard */ +-- +2.31.1 + diff --git a/SOURCES/0001-lldp_util-allow-for-null-ifa_addr-element.patch b/SOURCES/0001-lldp_util-allow-for-null-ifa_addr-element.patch new file mode 100644 index 0000000..1e704e5 --- /dev/null +++ b/SOURCES/0001-lldp_util-allow-for-null-ifa_addr-element.patch @@ -0,0 +1,35 @@ +From d0ed3f78b82e2e9a4e39451b7559804f19697533 Mon Sep 17 00:00:00 2001 +From: Aaron Conole +Date: Wed, 31 Jul 2019 16:03:09 -0400 +Subject: [PATCH] lldp_util: allow for null ifa_addr element + +The call to getifaddrs assumes that ifa_addr is always a valid pointer, but +getifaddrs is allowed to return a NULL value in that field. Check that the +value is valid before attempting to access. + +Signed-off-by: Aaron Conole +--- + lldp_util.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/lldp_util.c b/lldp_util.c +index 32df768..c43abbf 100644 +--- a/lldp_util.c ++++ b/lldp_util.c +@@ -1055,9 +1055,11 @@ int get_saddr6(const char *ifname, struct sockaddr_in6 *saddr) + + rc = getifaddrs(&ifaddr); + if (rc == 0) { ++ rc = -1; + for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) { +- if ((ifa->ifa_addr->sa_family == AF_INET6) && +- (strncmp(ifa->ifa_name, ifname, IFNAMSIZ) == 0)) { ++ if (strncmp(ifa->ifa_name, ifname, IFNAMSIZ)) ++ continue; ++ if (ifa->ifa_addr && (ifa->ifa_addr->sa_family == AF_INET6)) { + memcpy(saddr, ifa->ifa_addr, sizeof(*saddr)); + rc = 0; + break; +-- +2.21.0 + diff --git a/SPECS/lldpad.spec b/SPECS/lldpad.spec index e802a38..14a0cab 100644 --- a/SPECS/lldpad.spec +++ b/SPECS/lldpad.spec @@ -5,7 +5,7 @@ Name: lldpad Version: 1.0.1 -Release: 5.git%{checkout}%{?dist} +Release: 7.git%{checkout}%{?dist} Summary: Intel LLDP Agent Group: System Environment/Daemons License: GPLv2 @@ -42,6 +42,9 @@ Patch27: open-lldp-v1.0.1-27-fix-build-warnings.patch Patch99: lldpad-0.9.46-Ignore-supplied-PG-configuration-if-PG-is-being-disabled.patch Patch100: open-lldp-v1.0.1-28-fix-oid-display.patch Patch101: 0001-memleak-on-received-TLVs-from-modules.patch +Patch102: 0001-lldp_util-allow-for-null-ifa_addr-element.patch +Patch103: 0001-ecp-allow-for-failure-to-create.patch +Patch104: 0001-l2_packet-Guard-ETH_P_LLDP-define.patch Requires: kernel >= 2.6.32 BuildRequires: automake autoconf libtool @@ -134,6 +137,13 @@ fi %{_libdir}/liblldp_clif.so %changelog +* Tue Jul 05 2022 Aaron Conole - 1.0.1-7.git036e314 +- Fix compiler guard + +* Fri Sep 06 2019 Aaron Conole - 1.0.1-6.git036e314 +- Fix lldpad dereference NULL (#1513337) +- Fix ecp22_start() failure to create object (#1510945) + * Tue Feb 26 2019 Aaron Conole - 1.0.1-5.git036e314 - Fix memory leak on TLV reception (#1196320)