diff --git a/SOURCES/0001-memleak-on-received-TLVs-from-modules.patch b/SOURCES/0001-memleak-on-received-TLVs-from-modules.patch new file mode 100644 index 0000000..d186ca3 --- /dev/null +++ b/SOURCES/0001-memleak-on-received-TLVs-from-modules.patch @@ -0,0 +1,110 @@ +From 9b0389837d7532909a8070d5a08f0175c367c12e Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Wed, 23 May 2018 16:37:51 -0700 +Subject: [PATCH] memleak on received TLVs from modules + +Most of the TLV modules that have an rchange handler for received TLVs +seem to get the return values wrong, returning 0 or TLV_OK without +freeing or storing the unpacked TLV to be freed later. That leaks the +allocation, as rxProcessFrame believes the module has claimed ownership. + +In a test setup, it's probably easiest to see by enabling some TLV type +on one side of a connection only. Or, any unexpected TLV that doesn't +get handled will be erroneously leaked by the EVB modules. +--- + lldp_8021qaz.c | 4 ++-- + lldp_evb.c | 8 +++++--- + lldp_evb22.c | 8 +++++--- + 3 files changed, 12 insertions(+), 8 deletions(-) + +diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c +index 094676d..198ebcf 100644 +--- a/lldp_8021qaz.c ++++ b/lldp_8021qaz.c +@@ -1924,7 +1924,7 @@ int ieee8021qaz_rchange(struct port *port, struct lldp_agent *agent, + struct ieee8021qaz_unpkd_tlvs *rx; + + if (agent->type != NEAREST_BRIDGE) +- return 0; ++ return SUBTYPE_INVALID; + + qaz_tlvs = ieee8021qaz_data(port->ifname); + if (!qaz_tlvs) +@@ -2005,7 +2005,7 @@ int ieee8021qaz_rchange(struct port *port, struct lldp_agent *agent, + } + } + +- return TLV_OK; ++ return SUBTYPE_INVALID; + } + + static void ieee8021qaz_free_rx(struct ieee8021qaz_unpkd_tlvs *rx) +diff --git a/lldp_evb.c b/lldp_evb.c +index 4b3752e..07f5ffb 100644 +--- a/lldp_evb.c ++++ b/lldp_evb.c +@@ -210,7 +210,8 @@ static int evb_rchange(struct port *port, struct lldp_agent *agent, + u8 oui_subtype[OUI_SUB_SIZE] = LLDP_OUI_SUBTYPE; + + if (agent->type != NEAREST_CUSTOMER_BRIDGE) +- return 0; ++ return SUBTYPE_INVALID; ++ + ed = evb_data(port->ifname, agent->type); + + if (!ed) +@@ -229,7 +230,7 @@ static int evb_rchange(struct port *port, struct lldp_agent *agent, + if (!ed->txmit) { + LLDPAD_WARN("%s:%s agent %d EVB Config disabled\n", + __func__, ed->ifname, agent->type); +- return TLV_OK; ++ return SUBTYPE_INVALID; + } + + LLDPAD_DBG("%s:%s agent %d received tlv:\n", __func__, +@@ -246,7 +247,8 @@ static int evb_rchange(struct port *port, struct lldp_agent *agent, + evb_print_tlvinfo(ed->ifname, &ed->tie); + vdp_update(port->ifname, ed->tie.ccap); + } +- return TLV_OK; ++ ++ return SUBTYPE_INVALID; + } + + /* +diff --git a/lldp_evb22.c b/lldp_evb22.c +index 85c6abc..64b04e0 100644 +--- a/lldp_evb22.c ++++ b/lldp_evb22.c +@@ -305,7 +305,8 @@ static int evb22_rchange(struct port *port, struct lldp_agent *agent, + u8 oui_subtype[OUI_SUB_SIZE] = LLDP_MOD_EVB22_OUI; + + if (agent->type != NEAREST_CUSTOMER_BRIDGE) +- return 0; ++ return SUBTYPE_INVALID; ++ + ed = evb22_data(port->ifname, agent->type); + + if (!ed) +@@ -324,7 +325,7 @@ static int evb22_rchange(struct port *port, struct lldp_agent *agent, + if (!ed->txmit) { + LLDPAD_WARN("%s:%s agent %d EVB Config disabled\n", + __func__, ed->ifname, agent->type); +- return TLV_OK; ++ return SUBTYPE_INVALID; + } + + LLDPAD_DBG("%s:%s agent %d received tlv:\n", __func__, +@@ -341,7 +342,8 @@ static int evb22_rchange(struct port *port, struct lldp_agent *agent, + evb22_print_tlvinfo(ed->ifname, &ed->out); + /* TODO vdp_update(port->ifname, ed->tie.ccap); */ + } +- return TLV_OK; ++ ++ return SUBTYPE_INVALID; + } + + /* +-- +2.19.1 + diff --git a/SOURCES/open-lldp-v1.0.1-28-fix-oid-display.patch b/SOURCES/open-lldp-v1.0.1-28-fix-oid-display.patch new file mode 100644 index 0000000..74ef1dd --- /dev/null +++ b/SOURCES/open-lldp-v1.0.1-28-fix-oid-display.patch @@ -0,0 +1,52 @@ +From cf3f54d1883e5bc23e4c4006a63e1dde88684013 Mon Sep 17 00:00:00 2001 +From: Aaron Conole +Date: Thu, 21 Jun 2018 13:28:48 -0400 +Subject: [PATCH] basman_clif: print the OID properly + +When invoking the lldp tool to view the management information, the display +for the OID is printed as the actual binary bits, rather than the +OID dotted-notation form. + +This change will display the OID as expected. + +Signed-off-by: Aaron Conole +--- + lldp_basman_clif.c | 18 ++++++++++++++++-- + 1 file changed, 16 insertions(+), 2 deletions(-) + +diff --git a/lldp_basman_clif.c b/lldp_basman_clif.c +index 7dba9d2..abd152d 100644 +--- a/lldp_basman_clif.c ++++ b/lldp_basman_clif.c +@@ -272,8 +272,15 @@ void print_mng_addr(u16 len, char *info) + memset(buf, 0, sizeof(buf)); + if (hexstr2bin(info+offset, (u8 *)&buf, oidlen)) + printf("\tOID: Error parsing OID\n"); +- else +- printf("\tOID: %s\n", buf); ++ else { ++ printf("\tOID: 0."); ++ for (i = 0; i < oidlen; ++i) { ++ printf("%d", buf[i]); ++ if (i != (oidlen - 1)) ++ printf("."); ++ } ++ printf("\n"); ++ } + } else if (oidlen > 128) { + printf("\tOID: Invalid length = %d\n", oidlen); + } +@@ -310,3 +317,10 @@ u32 basman_lookup_tlv_name(char *tlvid_str) + } + return INVALID_TLVID; + } ++ ++/* Local Variables: */ ++/* c-indent-level: 8 */ ++/* c-basic-offset: 8 */ ++/* tab-width: 8 */ ++/* indent-tabs-mode: t */ ++/* End: */ +-- +2.14.3 + diff --git a/SPECS/lldpad.spec b/SPECS/lldpad.spec index b28626e..e802a38 100644 --- a/SPECS/lldpad.spec +++ b/SPECS/lldpad.spec @@ -5,7 +5,7 @@ Name: lldpad Version: 1.0.1 -Release: 3.git%{checkout}%{?dist} +Release: 5.git%{checkout}%{?dist} Summary: Intel LLDP Agent Group: System Environment/Daemons License: GPLv2 @@ -40,6 +40,8 @@ Patch26: open-lldp-v1.0.1-26-lldpad-system-capability-incorrect-adver # not upstream 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 Requires: kernel >= 2.6.32 BuildRequires: automake autoconf libtool @@ -132,6 +134,12 @@ fi %{_libdir}/liblldp_clif.so %changelog +* Tue Feb 26 2019 Aaron Conole - 1.0.1-5.git036e314 +- Fix memory leak on TLV reception (#1196320) + +* Wed Aug 08 2018 Aaron Conole - 1.0.1-4.git036e314 +- fix the OID printing routine (#1551623) + * Wed Jul 06 2016 Chris Leech - 1.0.1-3.git036e314 - 1273663 sync with upstream v1.0.1-26-g036e314 system capability incorrect advertised as station only