From: Vincent Bernat Date: Sat, 30 Jan 2021 15:39:59 +0000 (+0100) Subject: interfaces: do not use interface alias if we set it ourselves X-Git-Tag: 1.0.9~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=add95b843bdbad22f6b0e6b6c34548408fef5597;p=thirdparty%2Flldpd.git interfaces: do not use interface alias if we set it ourselves Fix #431 --- diff --git a/NEWS b/NEWS index 18b059ff..55872092 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +lldpd (1.0.9) + * Fix: + + Do not use interface alias if we set it ourselves. + lldpd (1.0.8) * Fix: + Out-of-bound read access when parsing LLDP-MED civic address in diff --git a/src/daemon/interfaces.c b/src/daemon/interfaces.c index c873630d..e39ae415 100644 --- a/src/daemon/interfaces.c +++ b/src/daemon/interfaces.c @@ -588,7 +588,9 @@ interfaces_helper_port_name_desc(struct lldpd *cfg, /* We need to set the portid to what the client configured. This can be done from the CLI. */ - int has_alias = (iface->alias != NULL && strlen(iface->alias) != 0); + int has_alias = (iface->alias != NULL + && strlen(iface->alias) != 0 + && strncmp("lldpd: ", iface->alias, 7)); int portid_type = cfg->g_config.c_lldp_portid_type; if (portid_type == LLDP_PORTID_SUBTYPE_IFNAME || (portid_type == LLDP_PORTID_SUBTYPE_UNKNOWN && has_alias) || diff --git a/tests/integration/test_interfaces.py b/tests/integration/test_interfaces.py index dbef4543..5e43752e 100644 --- a/tests/integration/test_interfaces.py +++ b/tests/integration/test_interfaces.py @@ -357,3 +357,11 @@ def test_set_interface_description(lldpd, lldpcli, namespaces, links): # Alias should be set alias = open("/sys/class/net/eth0/ifalias").read().strip() assert alias == "lldpd: connected to ns-2.example.com" + # Alias should not be sent to neighbor + lldpcli("update") + time.sleep(1) + with namespaces(2): + out = lldpcli("-f", "keyvalue", "show", "neighbors", "details") + print(out) + assert out['lldp.eth1.port.descr'] == 'eth0' +