From 637b9881f81fda3f288a1a1ecaac60a7ceefcddd Mon Sep 17 00:00:00 2001 From: Ido Schimmel Date: Sat, 14 Sep 2019 16:24:55 +0300 Subject: [PATCH] Do not enable port if already enabled Signed-off-by: Ido Schimmel --- lldpad.spec | 10 ++- ...o-not-enable-port-if-already-enabled.patch | 63 +++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 open-lldp-v1.0.1-30-lldpad-Do-not-enable-port-if-already-enabled.patch diff --git a/lldpad.spec b/lldpad.spec index d86753f..0b6fe3b 100644 --- a/lldpad.spec +++ b/lldpad.spec @@ -7,7 +7,7 @@ Name: lldpad Version: 1.0.1 -Release: 15.git%{checkout}%{?dist} +Release: 16.git%{checkout}%{?dist} Summary: Intel LLDP Agent License: GPLv2 URL: http://open-lldp.org/ @@ -49,6 +49,10 @@ Patch28: open-lldp-v1.0.1-28-support-DSCP-selectors.patch # https://github.com/intel/openlldp/pull/7 Patch29: open-lldp-v1.0.1-29-basman_clif-print-the-OID-properly.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1752207 +# https://github.com/intel/openlldp/pull/31 +Patch30: open-lldp-v1.0.1-30-lldpad-Do-not-enable-port-if-already-enabled.patch + BuildRequires: automake autoconf libtool BuildRequires: flex >= 2.5.33 BuildRequires: kernel-headers >= 2.6.32 @@ -118,6 +122,10 @@ rm -f %{buildroot}%{_libdir}/liblldp_clif.la %{_libdir}/liblldp_clif.so %changelog +* Sat Sep 14 2019 Ido Schimmel - 1.0.1-16.git036e314 +- Add open-lldp-v1.0.1-30-lldpad-Do-not-enable-port-if-already-enabled.patch + (BZ 1752207) + * Thu Jul 25 2019 Fedora Release Engineering - 1.0.1-15.git036e314 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/open-lldp-v1.0.1-30-lldpad-Do-not-enable-port-if-already-enabled.patch b/open-lldp-v1.0.1-30-lldpad-Do-not-enable-port-if-already-enabled.patch new file mode 100644 index 0000000..deb3fbc --- /dev/null +++ b/open-lldp-v1.0.1-30-lldpad-Do-not-enable-port-if-already-enabled.patch @@ -0,0 +1,63 @@ +From 78fd49291293d9f0da5b1bfa064a477c221cf6f8 Mon Sep 17 00:00:00 2001 +From: Ido Schimmel +Date: Sun, 11 Aug 2019 17:16:44 +0300 +Subject: [PATCH] lldpad: Do not enable port if already enabled + +When a port is enslaved to a bridge, the kernel will emit multiple +RTM_NEWLINK messages for the port when the bridge device is brought down +and then up. Assuming 'swp3' is enslaved to 'br0', the following link +events will be generated when 'br0' is toggled: + +# ip monitor link +9: swp3: mtu 1500 master br0 state UP + link/ether 7c:fe:90:ff:27:d1 +31: br0: mtu 1500 qdisc noqueue state DOWN group default + link/ether 7c:fe:90:ff:27:d1 brd ff:ff:ff:ff:ff:ff +9: swp3: mtu 1500 master br0 state UP + link/ether 7c:fe:90:ff:27:d1 +9: swp3: mtu 1500 master br0 state UP + link/ether 7c:fe:90:ff:27:d1 +31: br0: mtu 1500 qdisc noqueue state DOWN group default + link/ether 7c:fe:90:ff:27:d1 brd ff:ff:ff:ff:ff:ff +31: br0: mtu 1500 qdisc noqueue state UP group default + link/ether 7c:fe:90:ff:27:d1 brd ff:ff:ff:ff:ff:ff +9: swp3: mtu 1500 master br0 state UP + link/ether 7c:fe:90:ff:27:d1 + +These events will cause lldpad to invoke lldp_mod_ifup() multiple times +for 'swp3' despite the fact the port is already enabled as far as lldpad +is concerned. + +In the specific case of the 802.1Qaz module, multiple invocations of +ieee8021qaz_ifup() will result in the port being stuck in 'pending' +state. The state can be cleared by the dormant timer, but this is never +initialized as the port's operational state is always 'UP' as evident by +the generated events. + +Fix this by preventing lldpad from enabling the port if it is already +enabled. + +Signed-off-by: Ido Schimmel +Reported-by: Alex Kushnarov +Tested-by: Alex Kushnarov +--- + event_iface.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/event_iface.c b/event_iface.c +index 0a4105278bf3..43a95c78c89a 100644 +--- a/event_iface.c ++++ b/event_iface.c +@@ -205,6 +205,9 @@ int oper_add_device(char *device_name) + port = newport; + } else if (is_bond(device_name) || !port->portEnabled) + reinit_port(device_name); ++ else if (port->portEnabled) { ++ return 0; ++ } + + lldp_add_agent(device_name, NEAREST_BRIDGE); + lldp_add_agent(device_name, NEAREST_NONTPMR_BRIDGE); +-- +2.21.0 +