/*
+ * 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.
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;
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)
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;
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;
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))
}
}
- if (AF_IP6 == ip_addr_version (&ip) ||
- FIB_PROTOCOL_IP6 == allowed_ip.fp_proto)
- rv = VNET_API_ERROR_INVALID_PROTOCOL;
- else
- rv = wg_peer_add (tun_sw_if_index,
- public_key,
- table_id,
- &ip_addr_46 (&ip),
- allowed_ips,
- portDst, persistent_keepalive, &peer_index);
+ rv = wg_peer_add (tun_sw_if_index, public_key, table_id, &ip_addr_46 (&ip),
+ allowed_ips, portDst, persistent_keepalive, &peer_index);
switch (rv)
{
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;
if (!unformat_user (input, unformat_line_input, line_input))
return 0;
+ wg_feature_init (wmp);
+
if (unformat (line_input, "%d", &peer_index))
;
else
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;