27 #define foreach_ipsec_input_error \ 28 _(RX_PKTS, "IPSEC pkts received") \ 29 _(DECRYPTION_FAILED, "IPSEC decryption failed") 33 #define _(sym,str) IPSEC_INPUT_ERROR_##sym, 40 #define _(sym,string) string, 60 if (t->
spi == 0 && t->
seq == 0)
62 s =
format (s,
"esp: no esp packet");
72 s =
format (s,
"esp: no sa spi %u seq %u", t->
spi, t->
seq);
104 if (da < clib_net_to_host_u32 (p->
laddr.
start.ip4.as_u32))
107 if (da > clib_net_to_host_u32 (p->
laddr.
stop.ip4.as_u32))
110 if (sa < clib_net_to_host_u32 (p->
raddr.
start.ip4.as_u32))
113 if (sa > clib_net_to_host_u32 (p->
raddr.
stop.ip4.as_u32))
178 u32 n_left_from, *from, next_index, *to_next;
186 while (n_left_from > 0)
192 while (n_left_from > 0 && n_left_to_next > 0)
203 bi0 = to_next[0] = from[0];
210 b0->
flags |= VNET_BUFFER_F_IS_IP4;
211 b0->
flags &= ~VNET_BUFFER_F_IS_IP6;
219 (ip0->
protocol == IP_PROTOCOL_IPSEC_ESP
220 || ip0->
protocol == IP_PROTOCOL_UDP))
224 (
"packet received from %U to %U spi %u size %u spd_id %u",
227 clib_net_to_host_u32 (esp0->
spi),
228 clib_net_to_host_u16 (ip0->
length), spd0->
id);
266 if (ip0->
protocol == IP_PROTOCOL_IPSEC_ESP ||
271 tr->
spi = clib_host_to_net_u32 (esp0->
spi);
272 tr->
seq = clib_host_to_net_u32 (esp0->
seq);
307 if (ip0->
protocol == IP_PROTOCOL_IPSEC_ESP)
311 tr->
spi = clib_host_to_net_u32 (ah0->
spi);
312 tr->
seq = clib_host_to_net_u32 (ah0->
seq_no);
318 to_next, n_left_to_next, bi0,
324 IPSEC_INPUT_ERROR_RX_PKTS,
334 .name =
"ipsec-input-ip4",
335 .vector_size =
sizeof (
u32),
344 #define _(s,n) [IPSEC_INPUT_NEXT_##s] = n, 359 u32 n_left_from, *from, next_index, *to_next;
367 while (n_left_from > 0)
373 while (n_left_from > 0 && n_left_to_next > 0)
383 u32 header_size =
sizeof (ip0[0]);
385 bi0 = to_next[0] = from[0];
392 b0->
flags |= VNET_BUFFER_F_IS_IP6;
393 b0->
flags &= ~VNET_BUFFER_F_IS_IP4;
406 (
"packet received from %U to %U spi %u size %u spd_id %u",
431 else if (ip0->
protocol == IP_PROTOCOL_IPSEC_AH)
457 if (ip0->
protocol == IP_PROTOCOL_IPSEC_ESP)
461 tr->
spi = clib_host_to_net_u32 (esp0->
spi);
462 tr->
seq = clib_host_to_net_u32 (esp0->
seq);
467 n_left_to_next, bi0, next0);
472 IPSEC_INPUT_ERROR_RX_PKTS,
482 .name =
"ipsec-input-ip6",
483 .vector_size =
sizeof (
u32),
490 .sibling_of =
"ipsec-input-ip4",
u32 * ipv6_inbound_protect_policy_indices
u32 ah_decrypt_next_index
u32 * ipv4_inbound_protect_policy_indices
ip46_address_t tunnel_src_addr
#define foreach_ipsec_input_next
ipsec_policy_t * policies
static_always_inline void * vnet_feature_next_with_data(u32 *next0, vlib_buffer_t *b0, u32 n_data_bytes)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
counter_t packets
packet counter
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
ip46_address_range_t laddr
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
ip46_address_t tunnel_dst_addr
#define VLIB_REGISTER_NODE(x,...)
u32 esp_decrypt_next_index
#define clib_warning(format, args...)
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
ip46_address_range_t raddr
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static uword ip6_address_is_equal(const ip6_address_t *a, const ip6_address_t *b)
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
counter_t bytes
byte counter
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define vec_foreach(var, vec)
Vector iterator.
static int ip4_header_bytes(const ip4_header_t *i)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.