summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip-neighbor
diff options
context:
space:
mode:
authorIvan Shvedunov <ivan4th@gmail.com>2021-02-19 23:32:18 +0300
committerNeale Ranns <neale@graphiant.com>2021-02-22 15:18:41 +0000
commitf86b967c368ed982ca439a96bab4604025345c00 (patch)
tree44ae6e1283e543abd331590b5f473ac3b6b1d611 /src/vnet/ip-neighbor
parent255554fd7e75a803569e311c28e8ec8da8e7a286 (diff)
ip-neighbor: add set ip neighbor-config CLI command
Type: improvement Signed-off-by: Ivan Shvedunov <ivan4th@gmail.com> Change-Id: I77ade50425e88d2da979f732d2248bed383f4ba4
Diffstat (limited to 'src/vnet/ip-neighbor')
-rw-r--r--src/vnet/ip-neighbor/ip_neighbor.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/vnet/ip-neighbor/ip_neighbor.c b/src/vnet/ip-neighbor/ip_neighbor.c
index 78b45a27c9d..8637e16fd8e 100644
--- a/src/vnet/ip-neighbor/ip_neighbor.c
+++ b/src/vnet/ip-neighbor/ip_neighbor.c
@@ -23,6 +23,7 @@
#include <vnet/ip-neighbor/ip_neighbor_watch.h>
#include <vnet/ip/ip6_ll_table.h>
+#include <vnet/ip/ip46_address.h>
#include <vnet/fib/fib_table.h>
#include <vnet/adj/adj_mcast.h>
@@ -1717,12 +1718,65 @@ ip_neighbor_config_show (vlib_main_t * vm,
return (NULL);
}
+static clib_error_t *
+ip_neighbor_config_set (vlib_main_t *vm, unformat_input_t *input,
+ vlib_cli_command_t *cmd)
+{
+ unformat_input_t _line_input, *line_input = &_line_input;
+ clib_error_t *error = NULL;
+ ip_address_family_t af;
+ u32 limit, age;
+ bool recycle;
+
+ if (!unformat_user (input, unformat_line_input, line_input))
+ return 0;
+
+ if (!unformat (line_input, "%U", unformat_ip_address_family, &af))
+ {
+ error = unformat_parse_error (line_input);
+ goto done;
+ }
+
+ limit = ip_neighbor_db[af].ipndb_limit;
+ age = ip_neighbor_db[af].ipndb_age;
+ recycle = ip_neighbor_db[af].ipndb_recycle;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "limit %u", &limit))
+ ;
+ else if (unformat (line_input, "age %u", &age))
+ ;
+ else if (unformat (line_input, "recycle"))
+ recycle = true;
+ else if (unformat (line_input, "norecycle"))
+ recycle = false;
+ else
+ {
+ error = unformat_parse_error (line_input);
+ goto done;
+ }
+ }
+
+ ip_neighbor_config (af, limit, age, recycle);
+
+done:
+ unformat_free (line_input);
+ return error;
+}
+
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_ip_neighbor_cfg_cmd_node, static) = {
.path = "show ip neighbor-config",
.function = ip_neighbor_config_show,
.short_help = "show ip neighbor-config",
};
+VLIB_CLI_COMMAND (set_ip_neighbor_cfg_cmd_node, static) = {
+ .path = "set ip neighbor-config",
+ .function = ip_neighbor_config_set,
+ .short_help = "set ip neighbor-config ip4|ip6 [limit <limit>] [age <age>] "
+ "[recycle|norecycle]",
+};
/* *INDENT-ON* */
static clib_error_t *