]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
interfaces: do not use interface alias if we set it ourselves
authorVincent Bernat <vincent@bernat.ch>
Sat, 30 Jan 2021 15:39:59 +0000 (16:39 +0100)
committerVincent Bernat <vincent@bernat.ch>
Sat, 30 Jan 2021 15:39:59 +0000 (16:39 +0100)
Fix #431

NEWS
src/daemon/interfaces.c
tests/integration/test_interfaces.py

diff --git a/NEWS b/NEWS
index 18b059ff7498c562ceda81bd7b72b878a74e6f06..5587209272b793a5f4e260580d67e2e8b3eef578 100644 (file)
--- 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
index c873630d1958cf243ad9f493dd335082d4a44122..e39ae415573346fe60d241fe40348c65ccf3942d 100644 (file)
@@ -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) ||
index dbef45436c4f18bc4e903d9f0ef6103db5f1f3e9..5e43752ecd74326b1c0341258ed97a3a207f37d4 100644 (file)
@@ -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'
+