|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
40 u32 dev_instance = va_arg (*args,
u32);
41 return format (s,
"wg%d", dev_instance);
53 s =
format (s,
"[%d] %U src:%U port:%d",
94 uint8_t *
public =
data;
160 .name =
"Wireguard Tunnel",
175 #define WG_ITF_MAX_INSTANCE (16 * 1024)
251 *sw_if_indexp = (
u32) ~ 0;
258 return VNET_API_ERROR_UDP_PORT_TAKEN;
266 return VNET_API_ERROR_INVALID_REGISTRATION;
269 struct noise_upcall upcall = {
283 return VNET_API_ERROR_INVALID_REGISTRATION;
305 wg_if_device_class.index,
307 wg_hw_interface_class.index, t_idx);
327 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
331 return VNET_API_ERROR_INVALID_VALUE;
336 return VNET_API_ERROR_INVALID_SW_IF_INDEX_2;
339 return VNET_API_ERROR_INVALID_VALUE_2;
392 if (WALK_STOP == fn(wgi, peeri, data))
414 .old_fib_index = old_fib_index,
415 .new_fib_index = new_fib_index,
434 .old_fib_index = old_fib_index,
435 .new_fib_index = new_fib_index,
walk_rc_t wg_peer_if_table_change(wg_if_t *wgi, index_t peeri, void *data)
vnet_interface_main_t * im
u32 wg_index_table_add(wg_index_table_t *table, u32 peer_pool_idx, u32 rnd_seed)
static_always_inline wg_if_t * wg_if_get(index_t wgii)
wg_if_t * wg_if_pool
Data-plane exposed functions.
#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)
ip4_table_bind_callback_t * table_bind_callbacks
Functions to call when interface to table biding changes.
ip4_main_t ip4_main
Global ip4 main structure.
static int wg_if_instance_free(u32 instance)
wg_index_table_t index_table
static uword * wg_if_instances
static void wg_if_table_bind_v6(ip6_main_t *im, uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
walk_rc_t(* wg_if_walk_cb_t)(index_t wgi, void *data)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
@ VNET_HW_INTERFACE_FLAG_LINK_UP
static u32 wg_if_instance_alloc(u32 want)
walk_rc_t wg_peer_if_admin_state_change(wg_if_t *wgi, index_t peeri, void *data)
void wg_if_peer_remove(wg_if_t *wgi, index_t peeri)
uint8_t l_private[NOISE_PUBLIC_KEY_LEN]
static noise_remote_t * wg_remote_get(const uint8_t public[NOISE_PUBLIC_KEY_LEN])
#define pool_put_index(p, i)
Free pool element with given index.
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
u8 * format_wg_if(u8 *s, va_list *args)
ip6_table_bind_function_t * function
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define hash_set(h, key, value)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
cookie_checker_t cookie_checker
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
index_t wg_if_find_by_sw_if_index(u32 sw_if_index)
vlib_node_registration_t wg_input_node
(constructor) VLIB_REGISTER_NODE (wg_input_node)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
u8 * format_ip_address(u8 *s, va_list *args)
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
ip6_table_bind_callback_t * table_bind_callbacks
Functions to call when interface to table biding changes.
#define hash_foreach(key_var, value_var, h, body)
static u8 * format_wg_if_name(u8 *s, va_list *args)
void udp_register_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u32 node_index, u8 is_ip4)
index_t wg_if_peer_walk(wg_if_t *wgi, wg_if_peer_walk_cb_t fn, void *data)
walk_rc_t(* wg_if_peer_walk_cb_t)(wg_if_t *wgi, index_t peeri, void *data)
void udp_unregister_dst_port(vlib_main_t *vm, udp_dst_port_t dst_port, u8 is_ip4)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static index_t * wg_if_index_by_sw_if_index
index_t * wg_if_index_by_port
int wg_if_delete(u32 sw_if_index)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
VNET_HW_INTERFACE_CLASS(wg_hw_interface_class)
void wg_if_walk(wg_if_walk_cb_t fn, void *data)
vnet_sw_interface_t * sw_interfaces
noise_local_t * noise_local_pool
static uword hash_elts(void *v)
static clib_error_t * wg_if_module_init(vlib_main_t *vm)
bool key_to_base64(const u8 *src, size_t src_len, u8 *out)
uint8_t cc_mac1_key[COOKIE_KEY_SIZE]
static clib_error_t * wg_if_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define pool_foreach_index(i, v)
static_always_inline noise_local_t * noise_local_get(uint32_t locali)
static uint32_t wg_index_set(noise_remote_t *remote)
format_function_t format_vnet_sw_if_index_name
description fragment has unexpected format
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
#define NOISE_PUBLIC_KEY_LEN
VNET_DEVICE_CLASS(wg_if_device_class)
#define VLIB_INIT_FUNCTION(x)
static vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
void wg_if_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
static void wg_index_drop(uint32_t key)
ip4_table_bind_function_t * function
static void wg_if_table_bind_v4(ip4_main_t *im, uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index)
static walk_rc_t wg_if_find_peer_by_public_key(index_t peeri, void *data)
int vnet_feature_enable_disable(const char *arc_name, const char *node_name, u32 sw_if_index, int enable_disable, void *feature_config, u32 n_feature_config_bytes)
#define hash_unset(h, key)
u32 adj_index_t
An index for adjacencies.
void cookie_checker_update(cookie_checker_t *cc, uint8_t key[COOKIE_INPUT_SIZE])
static udp_dst_port_info_t * udp_get_dst_port_info(udp_main_t *um, udp_dst_port_t dst_port, u8 is_ip4)
static vlib_main_t * vlib_get_main(void)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
uint8_t l_public[NOISE_PUBLIC_KEY_LEN]
void noise_local_init(noise_local_t *l, struct noise_upcall *upcall)
#define WG_ITF_MAX_INSTANCE
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static wg_peer_t * wg_peer_get(index_t peeri)
void wg_index_table_del(wg_index_table_t *table, u32 key)
bool noise_local_set_private(noise_local_t *l, const uint8_t private[NOISE_PUBLIC_KEY_LEN])
static f64 vlib_time_now(vlib_main_t *vm)
@ VNET_HW_INTERFACE_CLASS_FLAG_NBMA
a non-broadcast multiple access interface
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
void ip_address_copy(ip_address_t *dst, const ip_address_t *src)
vl_api_interface_index_t sw_if_index
void wg_if_peer_add(wg_if_t *wgi, index_t peeri)
enum walk_rc_t_ walk_rc_t
Walk return code.
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
vnet_interface_main_t interface_main
index_t wg_peer_walk(wg_peer_walk_cb_t fn, void *data)
vl_api_wireguard_peer_flags_t flags