|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
49 else if (
unformat (line_input,
"private-key %s", &private_key_64))
62 else if (
unformat (line_input,
"generate-key"))
99 .path =
"wireguard create",
100 .short_help =
"wireguard create listen-port <port> "
101 "private-key <key> src <IP> [generate-key]",
148 .path =
"wireguard delete",
149 .short_help =
"wireguard delete <interface>",
164 u8 *public_key_64 = 0;
171 u32 tun_sw_if_index = ~0;
182 if (
unformat (line_input,
"public-key %s", &public_key_64))
195 else if (
unformat (line_input,
"port %d", &portDst))
197 else if (
unformat (line_input,
"persistent-keepalive %d",
200 else if (
unformat (line_input,
"allowed-ip %U",
206 else if (
unformat (line_input,
"%U",
218 rv = VNET_API_ERROR_INVALID_PROTOCOL;
229 case VNET_API_ERROR_KEY_LENGTH:
232 case VNET_API_ERROR_ENTRY_ALREADY_EXISTS:
235 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
238 case VNET_API_ERROR_LIMIT_EXCEEDED:
241 case VNET_API_ERROR_INIT_FAILED:
244 case VNET_API_ERROR_INVALID_PROTOCOL:
259 .path =
"wireguard peer add",
260 .short_help =
"wireguard peer add <wg_int> public-key <pub_key_other>"
261 "endpoint <ip4_dst> allowed-ip <prefix>"
262 "dst-port [port_dst] persistent-keepalive [keepalive_interval]",
282 if (
unformat (line_input,
"%d", &peer_index))
294 case VNET_API_ERROR_KEY_LENGTH:
307 .path =
"wireguard peer remove",
308 .short_help =
"wireguard peer remove <index>",
333 .path =
"show wireguard peer",
334 .short_help =
"show wireguard peer",
363 .path =
"show wireguard interface",
364 .short_help =
"show wireguard",
uword unformat_ip_prefix(unformat_input_t *input, va_list *args)
#define NOISE_KEY_LEN_BASE64
int wg_if_create(u32 user_instance, const u8 private_key[NOISE_PUBLIC_KEY_LEN], u16 port, const ip_address_t *src_ip, u32 *sw_if_indexp)
static walk_rc_t wg_peer_show_one(index_t peeri, void *arg)
int wg_peer_remove(index_t peeri)
#define clib_error_return(e, args...)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u8 * format_wg_if(u8 *s, va_list *args)
void wg_feature_init(wg_main_t *wmp)
#define ip_addr_version(_a)
uword unformat_ip_address(unformat_input_t *input, va_list *args)
static walk_rc_t wg_if_show_one(index_t itfi, void *arg)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vnet_main_t * vnet_get_main(void)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
static clib_error_t * wg_peer_add_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_cli_command_t wg_peer_remove_command
(constructor) VLIB_CLI_COMMAND (wg_peer_remove_command)
static clib_error_t * wg_show_peer_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int wg_peer_add(u32 tun_sw_if_index, const u8 public_key[NOISE_PUBLIC_KEY_LEN], u32 table_id, const ip46_address_t *endpoint, const fib_prefix_t *allowed_ips, u16 port, u16 persistent_keepalive, u32 *peer_index)
static clib_error_t * wg_if_delete_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int wg_if_delete(u32 sw_if_index)
#define VLIB_CLI_COMMAND(x,...)
static vlib_cli_command_t wg_if_create_command
(constructor) VLIB_CLI_COMMAND (wg_if_create_command)
void wg_if_walk(wg_if_walk_cb_t fn, void *data)
bool curve25519_gen_secret(u8 secret_key[CURVE25519_KEY_SIZE])
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_cli_command_t wg_show_peers_command
(constructor) VLIB_CLI_COMMAND (wg_show_peers_command)
static vlib_cli_command_t wg_peer_add_command
(constructor) VLIB_CLI_COMMAND (wg_peer_add_command)
#define vec_free(V)
Free vector's memory (no header).
vl_api_prefix_t allowed_ips[n_allowed_ips]
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
#define NOISE_PUBLIC_KEY_LEN
bool key_from_base64(const u8 *src, size_t src_len, u8 *out)
static clib_error_t * wg_peer_remove_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
fib_protocol_t fp_proto
protocol type
static clib_error_t * wg_show_if_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static vlib_cli_command_t wg_show_itfs_command
(constructor) VLIB_CLI_COMMAND (wg_show_itfs_command)
u8 * format_wg_peer(u8 *s, va_list *va)
static vlib_cli_command_t wg_if_delete_command
(constructor) VLIB_CLI_COMMAND (wg_if_delete_command)
vl_api_interface_index_t sw_if_index
enum walk_rc_t_ walk_rc_t
Walk return code.
Aggregate type for a prefix.
index_t wg_peer_walk(wg_peer_walk_cb_t fn, void *data)
static clib_error_t * wg_if_create_cli(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void ip_prefix_to_fib_prefix(const ip_prefix_t *ip_prefix, fib_prefix_t *fib_prefix)
convert from a LISP to a FIB prefix