summaryrefslogtreecommitdiffstats
path: root/src/plugins/wireguard/wireguard_api.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-10-09 11:33:55 -0400
committerDamjan Marion <dmarion@me.com>2020-10-09 17:20:28 +0000
commit6754a16ca3e01556f6d0383737aa22d89d32733b (patch)
treef66403ef75b59887dcf2cc84f7adaa4f1691c7e0 /src/plugins/wireguard/wireguard_api.c
parent695eb9353dc4895a17d960488675b7e44c8022db (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_api.c')
-rwxr-xr-xsrc/plugins/wireguard/wireguard_api.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/wireguard/wireguard_api.c b/src/plugins/wireguard/wireguard_api.c
index 283c09915fe..c9fe1e1a2d2 100755
--- a/src/plugins/wireguard/wireguard_api.c
+++ b/src/plugins/wireguard/wireguard_api.c
@@ -43,6 +43,8 @@ static void
u32 sw_if_index = ~0;
int rv = 0;
+ wg_feature_init (wmp);
+
ip_address_decode2 (&mp->interface.src_ip, &src);
if (AF_IP6 == ip_addr_version (&src))
@@ -75,6 +77,8 @@ static void
wg_main_t *wmp = &wg_main;
int rv = 0;
+ wg_feature_init (wmp);
+
VALIDATE_SW_IF_INDEX (mp);
rv = wg_if_delete (ntohl (mp->sw_if_index));
@@ -125,6 +129,9 @@ vl_api_wireguard_interface_dump_t_handler (vl_api_wireguard_interface_dump_t *
mp)
{
vl_api_registration_t *reg;
+ wg_main_t *wmp = &wg_main;
+
+ wg_feature_init (wmp);
reg = vl_api_client_index_to_registration (mp->client_index);
if (reg == 0)
@@ -157,6 +164,8 @@ vl_api_wireguard_peer_add_t_handler (vl_api_wireguard_peer_add_t * mp)
goto done;
}
+ wg_feature_init (wmp);
+
vec_validate (allowed_ips, mp->peer.n_allowed_ips - 1);
ip_address_decode2 (&mp->peer.endpoint, &endpoint);
@@ -195,6 +204,8 @@ vl_api_wireguard_peer_remove_t_handler (vl_api_wireguard_peer_remove_t * mp)
wg_main_t *wmp = &wg_main;
int rv = 0;
+ wg_feature_init (wmp);
+
rv = wg_peer_remove (ntohl (mp->peer_index));
/* *INDENT-OFF* */
@@ -247,6 +258,9 @@ static void
vl_api_wireguard_peers_dump_t_handler (vl_api_wireguard_peers_dump_t * mp)
{
vl_api_registration_t *reg;
+ wg_main_t *wmp = &wg_main;
+
+ wg_feature_init (wmp);
reg = vl_api_client_index_to_registration (mp->client_index);
if (reg == NULL)