|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
60 const ip46_address_t *
dst;
78 ip4->ip_version_and_header_length = 0x45;
82 ip4->dst_address.as_u32 =
dst->ip4.as_u32;
83 if (!(t->
flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP))
85 if (t->
flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_SET_DF)
91 ip4->protocol = IP_PROTOCOL_IPV6;
94 ip4->protocol = IP_PROTOCOL_IP_IN_IP;
97 ip4->protocol = IP_PROTOCOL_MPLS_IN_IP;
108 ip6->ip_version_traffic_class_and_flow_label =
109 clib_host_to_net_u32 (6 << 28);
114 ip6->dst_address.as_u64[0] =
dst->ip6.as_u64[0];
115 ip6->dst_address.as_u64[1] =
dst->ip6.as_u64[1];
116 if (!(t->
flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP))
122 ip6->protocol = IP_PROTOCOL_IPV6;
125 ip6->protocol = IP_PROTOCOL_IP_IN_IP;
128 ip6->protocol = IP_PROTOCOL_MPLS_IN_IP;
181 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
184 ip6->payload_length =
201 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
204 ip6->payload_length =
222 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
225 ip6->payload_length =
242 b->
flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
348 if (!(t->
flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
384 if (!(
ctx->t->flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_INNER_HASH))
457 u32 dev_instance = va_arg (*args,
u32);
461 if (dev_instance >=
vec_len (
gm->tunnels))
462 return format (s,
"<improperly-referenced>");
471 u32 dev_instance = va_arg (*args,
u32);
474 s =
format (s,
"IPIP tunnel: id %d\n", dev_instance);
503 ip46_address_t *
src, ip46_address_t *
dst,
u8 * is_l2)
520 .name =
"IPIP tunnel device",
593 const ip46_address_t *
src,
594 const ip46_address_t *
dst,
595 u32 fib_index, ipip_tunnel_key_t *
key)
597 key->transport = transport;
601 key->fib_index = fib_index;
631 ipip_tunnel_key_t
key;
668 ipip_tunnel_key_t
key;
701 ipip_tunnel_key_t
key;
713 ipip_tunnel_key_t
key;
734 ipip_tunnel_key_t
key;
738 return (VNET_API_ERROR_INVALID_DST_ADDRESS);
748 return VNET_API_ERROR_IF_ALREADY_EXISTS;
755 u32 t_idx = t -
gm->tunnels;
762 return VNET_API_ERROR_INSTANCE_IN_USE;
772 mipip_hw_interface_class.index),
819 gm->ip6_protocol_registered =
true;
826 gm->ip4_protocol_registered =
true;
837 ipip_tunnel_key_t
key;
841 return VNET_API_ERROR_NO_SUCH_ENTRY;
@ ADJ_FLAG_MIDCHAIN_NO_COUNT
void ipip_mk_key_i(ipip_transport_t transport, ipip_mode_t mode, const ip46_address_t *src, const ip46_address_t *dst, u32 fib_index, ipip_tunnel_key_t *key)
static u8 * format_ipip_device(u8 *s, va_list *args)
fib_protocol_t ia_nh_proto
The protocol of the neighbor/peer.
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
static u8 * ipip_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
static void ipip_tunnel_restack(ipip_tunnel_t *gt)
teib_entry_t * teib_entry_find_46(u32 sw_if_index, fib_protocol_t fproto, const ip46_address_t *peer)
static void ipip_teib_mk_key(const ipip_tunnel_t *t, const teib_entry_t *ne, ipip_tunnel_key_t *key)
enum tunnel_encap_decap_flags_t_ tunnel_encap_decap_flags_t
static_always_inline void tunnel_encap_fixup_mplso4(tunnel_encap_decap_flags_t flags, const mpls_unicast_header_t *inner, ip4_header_t *outer)
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
enum ip_dscp_t_ ip_dscp_t
static adj_midchain_fixup_t ipip_get_fixup(const ipip_tunnel_t *t, vnet_link_t lt, adj_flags_t *aflags)
@ ADJ_FLAG_MIDCHAIN_FIXUP_IP4O4_HDR
#define FOR_EACH_FIB_IP_PROTOCOL(_item)
ip4_main_t ip4_main
Global ip4 main structure.
static void ipip64_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
static uword pointer_to_uword(const void *p)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static clib_error_t * ipip_init(vlib_main_t *vm)
void(* adj_midchain_fixup_t)(vlib_main_t *vm, const struct ip_adjacency_t_ *adj, vlib_buffer_t *b0, const void *data)
A function type for post-rewrite fixups on midchain adjacency.
#define pool_get_aligned(P, E, A)
Allocate an object E from a pool P with alignment A.
ipip_tunnel_t * ipip_tunnel_db_find_by_sw_if_index(u32 sw_if_index)
static void ipip_teib_entry_deleted(const teib_entry_t *ne)
vlib_main_t vlib_node_runtime_t * node
enum adj_walk_rc_t_ adj_walk_rc_t
return codes from a adjacency walker callback function
vlib_node_registration_t ipip6_input_node
(constructor) VLIB_REGISTER_NODE (ipip6_input_node)
static adj_walk_rc_t mipip_mk_incomplete_walk(adj_index_t ai, void *data)
void adj_midchain_delegate_stack(adj_index_t ai, u32 fib_index, const fib_prefix_t *pfx)
create/attach a midchain delegate and stack it on the prefix passed
static void ipipm4_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
static_always_inline void tunnel_encap_fixup_mplso6(tunnel_encap_decap_flags_t flags, const vlib_buffer_t *b, const mpls_unicast_header_t *inner, ip6_header_t *outer)
vl_api_tunnel_mode_t mode
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static_always_inline void tunnel_encap_fixup_6o4(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip4_header_t *outer)
static_always_inline void ip6_set_dscp_network_order(ip6_header_t *ip6, ip_dscp_t dscp)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
ipip_transport_t transport
void ip4_register_protocol(u32 protocol, u32 node_index)
static void ipipm6_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
const fib_prefix_t * teib_entry_get_nh(const teib_entry_t *te)
A representation of a IPIP tunnel.
static void ip4_header_set_df(ip4_header_t *ip4)
static void ipip44_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
teib_entry_t * teib_entry_get(index_t tei)
#define hash_set(h, key, value)
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
#define ip_addr_version(_a)
u8 * format_ipip_tx_trace(u8 *s, va_list *args)
static_always_inline void tunnel_encap_fixup_6o6(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip6_header_t *outer)
static void ipip66_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
VNET_DEVICE_CLASS(ipip_device_class)
static clib_error_t * ipip_interface_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vnet_hw_interface_class_t ipip_hw_interface_class
void ipip_mk_key(const ipip_tunnel_t *t, ipip_tunnel_key_t *key)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
void ipip_tunnel_db_add(ipip_tunnel_t *t, const ipip_tunnel_key_t *key)
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
void ipip_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
void vnet_delete_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static void hash_unset_mem_free(uword **h, const void *key)
ip46_address_t tunnel_dst
#define hash_create_mem(elts, key_bytes, value_bytes)
static walk_rc_t ipip_tunnel_delete_teib_walk(index_t nei, void *ctx)
static void ip4_header_set_dscp(ip4_header_t *ip4, ip_dscp_t dscp)
static void hash_set_mem_alloc(uword **h, const void *key, uword v)
static_always_inline void tunnel_encap_fixup_4o4(tunnel_encap_decap_flags_t flags, const ip4_header_t *inner, ip4_header_t *outer)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
u32 * fib_index_by_sw_if_index
struct mipip_walk_ctx_t_ mipip_walk_ctx_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
int ipip_del_tunnel(u32 sw_if_index)
u32 teib_entry_get_fib_index(const teib_entry_t *te)
#define CLIB_CACHE_LINE_BYTES
void ipip_tunnel_db_remove(ipip_tunnel_t *t, const ipip_tunnel_key_t *key)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
static void ipip_teib_entry_added(const teib_entry_t *ne)
void adj_midchain_delegate_unstack(adj_index_t ai)
unstack a midchain delegate (this stacks it on a drop)
static u8 ip46_address_is_zero(const ip46_address_t *ip46)
union ip_adjacency_t_::@144 sub_type
void adj_nbr_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite)
adj_nbr_midchain_update_rewrite
void teib_walk_itf(u32 sw_if_index, teib_walk_cb_t fn, void *ctx)
void teib_register(const teib_vft_t *vft)
ip46_address_t tunnel_src
#define hash_get_mem(h, key)
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,...
format_function_t format_ip46_address
u32 teib_entry_get_sw_if_index(const teib_entry_t *te)
accessors for the opaque struct
vnet_link_t adj_get_link_type(adj_index_t ai)
Return the link type of the adjacency.
#define VLIB_INIT_FUNCTION(x)
static walk_rc_t ipip_tunnel_add_teib_walk(index_t nei, void *ctx)
ipip_tunnel_t * ipip_tunnel_db_find(const ipip_tunnel_key_t *key)
teib_entry_added_t nv_added
const ip_address_t * teib_entry_get_peer(const teib_entry_t *te)
#define hash_unset(h, key)
u32 adj_index_t
An index for adjacencies.
enum tunnel_mode_t_ tunnel_mode_t
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static int ipip_tunnel_desc(u32 sw_if_index, ip46_address_t *src, ip46_address_t *dst, u8 *is_l2)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
const static teib_vft_t ipip_teib_vft
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static u16 ip4_header_checksum(ip4_header_t *i)
void adj_nbr_walk_nh(u32 sw_if_index, fib_protocol_t adj_nh_proto, const ip46_address_t *nh, adj_walk_cb_t cb, void *ctx)
Walk adjacencies on a link with a given next-hop.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static void ipip_tunnel_stack(adj_index_t ai)
#define uword_to_pointer(u, type)
void teib_entry_adj_stack(const teib_entry_t *te, adj_index_t ai)
struct ip_adjacency_t_::@144::@145 nbr
IP_LOOKUP_NEXT_ARP/IP_LOOKUP_NEXT_REWRITE.
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
void adj_nbr_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk all adjacencies on a link for a given next-hop protocol.
void ip6_register_protocol(u32 protocol, u32 node_index)
static void ipip46_fixup(vlib_main_t *vm, const ip_adjacency_t *adj, vlib_buffer_t *b, const void *data)
static adj_walk_rc_t mipip_mk_complete_walk(adj_index_t ai, void *data)
static uword vnet_hw_interface_get_flags(vnet_main_t *vnm, u32 hw_if_index)
tunnel_encap_decap_flags_t flags
@ VNET_HW_INTERFACE_CLASS_FLAG_NBMA
a non-broadcast multiple access interface
static_always_inline void tunnel_encap_fixup_4o6(tunnel_encap_decap_flags_t flags, const vlib_buffer_t *b, const ip4_header_t *inner, ip6_header_t *outer)
vlib_node_registration_t ipip4_input_node
(constructor) VLIB_REGISTER_NODE (ipip4_input_node)
#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
static adj_walk_rc_t ipip_adj_walk_cb(adj_index_t ai, void *ctx)
VNET_HW_INTERFACE_CLASS(ipip_hw_interface_class)
void mipip_update_adj(vnet_main_t *vnm, u32 sw_if_index, adj_index_t ai)
enum walk_rc_t_ walk_rc_t
Walk return code.
@ ADJ_FLAG_MIDCHAIN_IP_STACK
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
Aggregate type for a prefix.
u32 vnet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, u32 hw_class_index, u32 hw_instance)
int ipip_add_tunnel(ipip_transport_t transport, u32 instance, ip46_address_t *src, ip46_address_t *dst, u32 fib_index, tunnel_encap_decap_flags_t flags, ip_dscp_t dscp, tunnel_mode_t tmode, u32 *sw_if_indexp)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
static u8 * format_ipip_tunnel_name(u8 *s, va_list *args)
VLIB buffer representation.
vl_api_wireguard_peer_flags_t flags