]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
fix: Some cleanup in moving fast-start into LLDP core
authorBreuninger Matthias (ETAS-DAP/XPC-Fe3) <Matthias.Breuninger@etas.com>
Fri, 17 Jan 2025 07:54:24 +0000 (08:54 +0100)
committerVincent Bernat <vincent@bernat.ch>
Sat, 9 Aug 2025 18:13:08 +0000 (20:13 +0200)
src/client/conf-med.c
src/client/lldpcli.8.in
tests/integration/test_lldpcli.py
tests/lldpcli.conf

index 36399557ef65f0cd0d11d3fc14275c10a36fedfe..bb3797a78c3da8df51ee6f4cb2d51d4e04f8b09d 100644 (file)
@@ -416,68 +416,6 @@ register_commands_medpol(struct cmd_node *configure_med)
        }
 }
 
-static int
-cmd_faststart(struct lldpctl_conn_t *conn, struct writer *w, struct cmd_env *env,
-    const void *arg)
-{
-       log_debug("lldpctl", "configure fast interval support");
-
-       lldpctl_atom_t *config = lldpctl_get_configuration(conn);
-       if (config == NULL) {
-               log_warnx("lldpctl", "unable to get configuration from lldpd. %s",
-                   lldpctl_last_strerror(conn));
-               return 0;
-       }
-
-       const char *action = arg;
-       if ((!strcmp(action, "enable") &&
-               (lldpctl_atom_set_int(config, lldpctl_k_config_fast_start_enabled, 1) ==
-                   NULL)) ||
-           (!strcmp(action, "disable") &&
-               (lldpctl_atom_set_int(config, lldpctl_k_config_fast_start_enabled, 0) ==
-                   NULL)) ||
-           (!strcmp(action, "delay") &&
-               (lldpctl_atom_set_str(config, lldpctl_k_config_fast_start_interval,
-                    cmdenv_get(env, "tx-interval")) == NULL))) {
-               log_warnx("lldpctl", "unable to setup fast start. %s",
-                   lldpctl_last_strerror(conn));
-               lldpctl_atom_dec_ref(config);
-               return 0;
-       }
-       log_info("lldpctl", "configuration for fast start applied");
-       lldpctl_atom_dec_ref(config);
-       return 1;
-}
-
-/**
- * Register "configure med fast-start *"
- */
-static void
-register_commands_medfast(struct cmd_node *med, struct cmd_node *nomed)
-{
-       struct cmd_node *configure_fast = commands_new(med, "fast-start",
-           "Fast start configuration", cmd_check_no_env, NULL, "ports");
-       struct cmd_node *unconfigure_fast = commands_new(nomed, "fast-start",
-           "Fast start configuration", cmd_check_no_env, NULL, "ports");
-
-       /* Enable */
-       commands_new(commands_new(configure_fast, "enable", "Enable fast start", NULL,
-                        NULL, NULL),
-           NEWLINE, "Enable fast start", NULL, cmd_faststart, "enable");
-
-       /* Set TX delay */
-       commands_new(commands_new(commands_new(configure_fast, "tx-interval",
-                                     "Set LLDP fast transmit delay", NULL, NULL, NULL),
-                        NULL, "LLDP fast transmit delay in seconds", NULL,
-                        cmd_store_env_value, "tx-interval"),
-           NEWLINE, "Set LLDP fast transmit delay", NULL, cmd_faststart, "delay");
-
-       /* Disable */
-       commands_new(commands_new(unconfigure_fast, NEWLINE, "Disable fast start", NULL,
-                        cmd_faststart, "disable"),
-           NEWLINE, "Disable fast start", NULL, cmd_faststart, "disable");
-}
-
 /**
  * Register "configure med *"
  */
index 298e4ada64f88a4da64d84bc3570a145ae99a47e..817fc7b2dd1ac80a0a324793f41fa169e70acd1d 100644 (file)
@@ -666,15 +666,15 @@ and subtype
 is specified, remove specific instances of custom TLV.
 .Ed
 
-.Cd configure med fast-start
+.Cd configure lldp fast-start
 .Cd enable | tx-interval Ar interval
 .Bd -ragged -offset XXXXXX
-Configure LLDP-MED fast start mechanism. When a new LLDP-MED-enabled
+Configure LLDP fast start mechanism. When a new LLDP
 neighbor is detected, fast start allows
 .Nm lldpd
 to shorten the interval between two LLDPDU.
 .Cd enable
-should enable LLDP-MED fast start while
+should enable LLDP fast start while
 .Cd tx-interval
 specifies the interval between two LLDPDU in seconds. The valid interval
 range is 1 through 3600 in seconds. The default interval is 1 second. Once
@@ -682,9 +682,9 @@ range is 1 through 3600 in seconds. The default interval is 1 second. Once
 neighbor is detected.
 .Ed
 
-.Cd unconfigure med fast-start
+.Cd unconfigure lldp fast-start
 .Bd -ragged -offset XXXXXX
-Disable LLDP-MED fast start mechanism.
+Disable LLDP fast start mechanism.
 .Ed
 
 .Cd configure
index 3e964dfc0095eae5a891881ff68ac58c1eab63c9..30d0a4e916735ca56acbccda6c6996209e760ec4 100644 (file)
@@ -690,24 +690,8 @@ def test_return_code(lldpd1, lldpcli, namespaces):
         ("configure lldp tx-interval 20", "tx-delay", 20),
         ("configure lldp tx-hold 5", "tx-hold", 5),
         ("configure lldp portidsubtype ifname", "lldp-portid-type", "ifname"),
-        pytest.param(
-            "unconfigure med fast-start",
-            "lldpmed-faststart",
-            "no",
-            marks=pytest.mark.skipif(
-                "'LLDP-MED' not in config.lldpd.features",
-                reason="LLDP-MED not supported",
-            ),
-        ),
-        pytest.param(
-            "configure med fast-start tx-interval 2",
-            "lldpmed-faststart-interval",
-            2,
-            marks=pytest.mark.skipif(
-                "'LLDP-MED' not in config.lldpd.features",
-                reason="LLDP-MED not supported",
-            ),
-        ),
+        ("unconfigure lldp fast-start", "fast-start", "no"),
+        ("configure lldp fast-start tx-interval 2", "fast-start-interval", 2),
         ("configure system interface pattern eth*", "iface-pattern", "eth*"),
         ("configure system interface permanent eth*", "perm-iface-pattern", "eth*"),
         ("configure system ip management pattern 10.*", "mgmt-pattern", "10.*"),
index d085f63c29a83b7c5e51000990d641e932c43261..4afabeecfae702bfff05fceefe906f4fbeb1d43c 100644 (file)
@@ -39,11 +39,11 @@ configure lldp custom-tlv add oui 33,44,55 subtype 55 oui-info 65,65,65,65,65
 configure lldp custom-tlv replace oui 33,44,55 subtype 44 oui-info 66,66,66,66,66
 unconfigure lldp custom-tlv oui 33,44,55 subtype 55
 unconfigure lldp custom-tlv
+configure lldp fast-start enable
+configure lldp fast-start tx-interval 3
+unconfigure lldp fast-start
 configure system bond-slave-src-mac-type fixed
 configure system bond-slave-src-mac-type local
-configure med fast-start enable
-configure med fast-start tx-interval 3
-unconfigure med fast-start
 configure med location coordinate latitude 48.58667N longitude 2.2014E altitude 117.47 m datum WGS84
 configure med location address country US language en_US street "Commercial Road" city "Roseville"
 configure med location elin 911