|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
24 #include <wireguard/wireguard.api_enum.h>
25 #include <wireguard/wireguard.api_types.h>
32 #define REPLY_MSG_ID_BASE wmp->msg_id_base
51 rv = VNET_API_ERROR_INVALID_PROTOCOL;
76 vl_api_wireguard_interface_delete_reply_t *rmp;
89 REPLY_MACRO(VL_API_WIREGUARD_INTERFACE_DELETE_REPLY);
112 rmp->_vl_msg_id = htons (VL_API_WIREGUARD_INTERFACE_DETAILS +
115 if (
ctx->show_private_key)
166 if (0 == mp->
peer.n_allowed_ips)
168 rv = VNET_API_ERROR_INVALID_VALUE;
177 for (ii = 0; ii < mp->
peer.n_allowed_ips; ii++)
184 rv = VNET_API_ERROR_INVALID_PROTOCOL;
188 ntohl (mp->
peer.table_id),
192 ntohs (mp->
peer.persistent_keepalive), &peeri);
208 vl_api_wireguard_peer_remove_reply_t *rmp;
237 rmp->_vl_msg_id = htons (VL_API_WIREGUARD_PEERS_DETAILS +
246 rmp->
peer.port = htons (
peer->dst.port);
248 rmp->
peer.sw_if_index = htonl (
peer->wg_sw_if_index);
253 &rmp->
peer.allowed_ips[ii]);
283 #include <wireguard/wireguard.api.c>
#define VALIDATE_SW_IF_INDEX(mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static_always_inline wg_if_t * wg_if_get(index_t wgii)
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)
#define REPLY_MACRO2(t, body)
#define clib_memcpy(d, s, n)
static void vl_api_wireguard_interface_delete_t_handler(vl_api_wireguard_interface_delete_t *mp)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
struct wg_deatils_walk_t_ wg_deatils_walk_t
int wg_peer_remove(index_t peeri)
static void vl_api_wireguard_interface_dump_t_handler(vl_api_wireguard_interface_dump_t *mp)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static walk_rc_t wireguard_if_send_details(index_t wgii, void *data)
vl_api_registration_t * reg
static void vl_api_wireguard_interface_create_t_handler(vl_api_wireguard_interface_create_t *mp)
void * vl_msg_api_alloc_zero(int nbytes)
@ WIREGUARD_PEER_STATUS_DEAD
uint8_t l_private[NOISE_PUBLIC_KEY_LEN]
void ip_prefix_encode(const fib_prefix_t *in, vl_api_prefix_t *out)
static void vl_api_wireguard_peers_dump_t_handler(vl_api_wireguard_peers_dump_t *mp)
Create an Wireguard interface.
void wg_feature_init(wg_main_t *wmp)
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
#define ip_addr_version(_a)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
Add Wireguard interface interface response.
static clib_error_t * wg_api_hookup(vlib_main_t *vm)
An API client registration, only in vpp/vlib.
static void setup_message_id_table(api_main_t *am)
vl_api_interface_index_t sw_if_index
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
void ip_prefix_decode(const vl_api_prefix_t *in, fib_prefix_t *out)
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)
vl_api_wireguard_peer_t peer
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
int wg_if_delete(u32 sw_if_index)
VLIB_API_INIT_FUNCTION(wg_api_hookup)
vl_api_wireguard_interface_t interface
vl_api_wireguard_interface_t interface
void wg_if_walk(wg_if_walk_cb_t fn, void *data)
bool curve25519_gen_secret(u8 secret_key[CURVE25519_KEY_SIZE])
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
#define BAD_SW_IF_INDEX_LABEL
#define vec_free(V)
Free vector's memory (no header).
vl_api_prefix_t allowed_ips[n_allowed_ips]
static_always_inline noise_local_t * noise_local_get(uint32_t locali)
vl_api_address_t endpoint
static void vl_api_wireguard_peer_add_t_handler(vl_api_wireguard_peer_add_t *mp)
#define NOISE_PUBLIC_KEY_LEN
void ip_address_encode(const ip46_address_t *in, ip46_type_t type, vl_api_address_t *out)
static void vl_api_wireguard_peer_remove_t_handler(vl_api_wireguard_peer_remove_t *mp)
uint8_t l_public[NOISE_PUBLIC_KEY_LEN]
static wg_peer_t * wg_peer_get(index_t peeri)
Remove peer by public_key.
static walk_rc_t send_wg_peers_details(index_t peeri, void *data)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
vl_api_interface_index_t sw_if_index
enum walk_rc_t_ walk_rc_t
Walk return code.
Aggregate type for a prefix.
vl_api_wireguard_peer_t peer
index_t wg_peer_walk(wg_peer_walk_cb_t fn, void *data)
vl_api_interface_index_t sw_if_index