diff options
author | Dave Barach <dave@barachs.net> | 2020-10-09 11:33:55 -0400 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-10-09 17:20:28 +0000 |
commit | 6754a16ca3e01556f6d0383737aa22d89d32733b (patch) | |
tree | f66403ef75b59887dcf2cc84f7adaa4f1691c7e0 /src/plugins/wireguard/wireguard_cli.c | |
parent | 695eb9353dc4895a17d960488675b7e44c8022db (diff) |
wireguard: park the timer process
Until the feature is configured. It would make sense to push more of
the feature init code into the newly-added wg_feature_init()
function. This patch fixes a severe hemorrhoid.
Type: improvement
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I87095575363baa41407dd52492159a7b8c2899e7
Diffstat (limited to 'src/plugins/wireguard/wireguard_cli.c')
-rwxr-xr-x | src/plugins/wireguard/wireguard_cli.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/wireguard/wireguard_cli.c b/src/plugins/wireguard/wireguard_cli.c index 16794156d17..3b4bf56a3dc 100755 --- a/src/plugins/wireguard/wireguard_cli.c +++ b/src/plugins/wireguard/wireguard_cli.c @@ -23,6 +23,7 @@ static clib_error_t * wg_if_create_cli (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { + wg_main_t *wmp = &wg_main; unformat_input_t _line_input, *line_input = &_line_input; u8 private_key[NOISE_PUBLIC_KEY_LEN]; u32 instance, sw_if_index; @@ -37,6 +38,8 @@ wg_if_create_cli (vlib_main_t * vm, private_key_64 = 0; port = 0; + wg_feature_init (wmp); + if (unformat_user (input, unformat_line_input, line_input)) { while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) @@ -104,10 +107,13 @@ static clib_error_t * wg_if_delete_cli (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { + wg_main_t *wmp = &wg_main; vnet_main_t *vnm; u32 sw_if_index; int rv; + wg_feature_init (wmp); + vnm = vnet_get_main (); sw_if_index = ~0; @@ -151,6 +157,7 @@ wg_peer_add_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { vnet_main_t *vnm = vnet_get_main (); + wg_main_t *wmp = &wg_main; clib_error_t *error = NULL; unformat_input_t _line_input, *line_input = &_line_input; @@ -168,6 +175,8 @@ wg_peer_add_command_fn (vlib_main_t * vm, if (!unformat_user (input, unformat_line_input, line_input)) return 0; + wg_feature_init (wmp); + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) { if (unformat (line_input, "public-key %s", &public_key_64)) @@ -259,6 +268,7 @@ static clib_error_t * wg_peer_remove_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { + wg_main_t *wmp = &wg_main; clib_error_t *error = NULL; u32 peer_index; int rv; @@ -267,6 +277,8 @@ wg_peer_remove_command_fn (vlib_main_t * vm, if (!unformat_user (input, unformat_line_input, line_input)) return 0; + wg_feature_init (wmp); + if (unformat (line_input, "%d", &peer_index)) ; else @@ -336,6 +348,10 @@ static clib_error_t * wg_show_if_command_fn (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) { + wg_main_t *wmp = &wg_main; + + wg_feature_init (wmp); + wg_if_walk (wg_if_show_one, vm); return NULL; |