From: Vincent Bernat Date: Sat, 6 Apr 2019 11:20:51 +0000 (+0200) Subject: client: rename max-neighbor command X-Git-Tag: 1.0.4~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e3cb2f550fbed3e22335ca778c3e2cbe8521064;p=thirdparty%2Flldpd.git client: rename max-neighbor command --- diff --git a/NEWS b/NEWS index 41c44e6b..4ce189e1 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ lldpd (1.0.4) * Changes: - + Add "set system lldp max-neighbors XX" command to modify maximum + + Add "configure system max-neighbors XX" command to modify maximum of neighbors accepted per port. lldpd (1.0.3) diff --git a/src/client/conf-lldp.c b/src/client/conf-lldp.c index 94f397e4..8523f3cc 100644 --- a/src/client/conf-lldp.c +++ b/src/client/conf-lldp.c @@ -70,30 +70,6 @@ cmd_txhold(struct lldpctl_conn_t *conn, struct writer *w, return 1; } -static int -cmd_maxneighs(struct lldpctl_conn_t *conn, struct writer *w, - struct cmd_env *env, void *arg) -{ - log_debug("lldpctl", "set maximum neighbors"); - - 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; - } - if (lldpctl_atom_set_str(config, - lldpctl_k_config_max_neighbors, cmdenv_get(env, "max-neighbors")) == NULL) { - log_warnx("lldpctl", "unable to set maximum of neighbors. %s", - lldpctl_last_strerror(conn)); - lldpctl_atom_dec_ref(config); - return 0; - } - log_info("lldpctl", "maximum neighbors set to new value %s", cmdenv_get(env, "max-neighbors")); - lldpctl_atom_dec_ref(config); - return 1; -} - static int cmd_status(struct lldpctl_conn_t *conn, struct writer *w, struct cmd_env *env, void *arg) @@ -560,16 +536,6 @@ register_commands_configure_lldp(struct cmd_node *configure, NEWLINE, "Set LLDP transmit hold", NULL, cmd_txhold, NULL); - commands_new( - commands_new( - commands_new(configure_lldp, - "max-neighbors", "Set maximum number of neighbors per port", - cmd_check_no_env, NULL, "ports"), - NULL, "Maximum number of neighbors", - NULL, cmd_store_env_value, "max-neighbors"), - NEWLINE, "Set maximum number of neighbors per port", - NULL, cmd_maxneighs, NULL); - struct cmd_node *status = commands_new(configure_lldp, "status", "Set administrative status", NULL, NULL, NULL); diff --git a/src/client/conf-system.c b/src/client/conf-system.c index f2ad664b..4bd7e752 100644 --- a/src/client/conf-system.c +++ b/src/client/conf-system.c @@ -298,6 +298,30 @@ cmd_bondslave_srcmac_type(struct lldpctl_conn_t *conn, struct writer *w, return 1; } +static int +cmd_maxneighs(struct lldpctl_conn_t *conn, struct writer *w, + struct cmd_env *env, void *arg) +{ + log_debug("lldpctl", "set maximum neighbors"); + + 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; + } + if (lldpctl_atom_set_str(config, + lldpctl_k_config_max_neighbors, cmdenv_get(env, "max-neighbors")) == NULL) { + log_warnx("lldpctl", "unable to set maximum of neighbors. %s", + lldpctl_last_strerror(conn)); + lldpctl_atom_dec_ref(config); + return 0; + } + log_info("lldpctl", "maximum neighbors set to new value %s", cmdenv_get(env, "max-neighbors")); + lldpctl_atom_dec_ref(config); + return 1; +} + /** * Register `configure system bond-slave-src-mac-type` */ @@ -440,6 +464,16 @@ register_commands_configure_system(struct cmd_node *configure, NEWLINE, "Don't override system name", NULL, cmd_hostname, NULL); + commands_new( + commands_new( + commands_new(configure_system, + "max-neighbors", "Set maximum number of neighbors per port", + cmd_check_no_env, NULL, "ports"), + NULL, "Maximum number of neighbors", + NULL, cmd_store_env_value, "max-neighbors"), + NEWLINE, "Set maximum number of neighbors per port", + NULL, cmd_maxneighs, NULL); + commands_new( commands_new( commands_new( diff --git a/src/client/lldpcli.8.in b/src/client/lldpcli.8.in index 68de74e6..bf902b0d 100644 --- a/src/client/lldpcli.8.in +++ b/src/client/lldpcli.8.in @@ -433,6 +433,14 @@ might lead to a duplicate MAC address on the network (but this is quite unlikely). .Ed +.Cd configure +.Cd system max-neighbors Ar neighbors +.Bd -ragged -offset XXXXXX +Change the maximum number of neighbors accepted (for each protocol) on +an interface. This is a global value. The default is 32. This setting +only applies to future neighbors. +.Ed + .Cd configure .Cd lldp agent-type .Cd nearest-bridge | nearest-non-tpmr-bridge | nearest-customer-bridge @@ -506,14 +514,6 @@ value and of the transmit delay. The default value is 4 and therefore the default TTL is 120 seconds. .Ed -.Cd configure -.Cd lldp max-neighbors Ar neighbors -.Bd -ragged -offset XXXXXX -Change the maximum number of neighbors accepted (for each protocol) on -an interface. This is a global value. The default is 32. This setting -only applies to future neighbors. -.Ed - .Cd configure .Op ports Ar ethX Op ,... .Cd lldp diff --git a/tests/integration/test_lldpcli.py b/tests/integration/test_lldpcli.py index 8530c63a..5502da27 100644 --- a/tests/integration/test_lldpcli.py +++ b/tests/integration/test_lldpcli.py @@ -550,9 +550,9 @@ def test_return_code(lldpd1, lldpcli, namespaces): @pytest.mark.parametrize("command, name, expected", [ + ("configure system max-neighbors 10", "max-neighbors", 10), ("configure lldp tx-interval 20", "tx-delay", 20), ("configure lldp tx-hold 5", "tx-hold", 5), - ("configure lldp max-neighbors 10", "max-neighbors", 10), ("configure lldp portidsubtype ifname", "lldp-portid-type", "ifname"), pytest.param("unconfigure med fast-start", "lldpmed-faststart", "no", diff --git a/tests/lldpcli.conf b/tests/lldpcli.conf index 30aacc1c..8a5ab296 100644 --- a/tests/lldpcli.conf +++ b/tests/lldpcli.conf @@ -23,13 +23,13 @@ configure system interface promiscuous unconfigure system interface promiscuous configure system ip management pattern * unconfigure system ip management pattern +configure system max-neighbors 16 configure lldp portidsubtype ifname configure lldp portidsubtype macaddress configure lldp portidsubtype local Batman configure lldp portidsubtype local Batman description Batman configure lldp tx-interval 30 configure lldp tx-hold 4 -configure lldp max-neighbors 16 configure lldp ports eth0 status tx-only configure lldp status rx-and-tx configure lldp custom-tlv oui 33,44,55 subtype 44