udp: allocate rx lock only for non-connected
[vpp.git] / src / plugins / wireguard / wireguard_cli.c
index 7fdccdc..3b4bf56 100755 (executable)
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2020 Cisco and/or its affiliates.
  * Copyright (c) 2020 Doc.ai and/or its affiliates.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,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;
@@ -36,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)
@@ -103,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;
 
@@ -150,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;
 
@@ -167,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))
@@ -258,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;
@@ -266,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
@@ -335,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;