53 return format (s,
"SRv6-AS-rewrite: cache is empty");
56 return format (s,
"SRv6-AS-rewrite: src %U dst %U",
69 #define foreach_srv6_as_rewrite_counter \ 70 _(PROCESSED, "srv6-as rewritten packets") \ 71 _(NO_RW, "(Error) No header for rewriting.") 75 #define _(sym,str) SRV6_AS_REWRITE_COUNTER_##sym, 82 #define _(sym,string) string, 118 ip6_ext_header_t *ext_hdr;
123 ext_hdr = (ip6_ext_header_t *) (ip0 + 1);
129 hdr_type = ext_hdr->next_hdr;
135 hdr_type != IP_PROTOCOL_IP_IN_IP &&
158 *next0 = (hdr_type == IP_PROTOCOL_IPV6) ?
171 u32 n_left_from, next_index, *from, *to_next;
178 while (n_left_from > 0)
186 while (n_left_from > 0 && n_left_to_next > 0)
229 n_left_to_next, bi0, next0);
243 .name =
"srv6-as-localsid",
244 .vector_size =
sizeof (
u32),
269 u32 n_left_from, next_index, *from, *to_next;
276 while (n_left_from > 0)
284 while (n_left_from > 0 && n_left_to_next > 0)
312 b0->
error = node->
errors[SRV6_AS_REWRITE_COUNTER_NO_RW];
344 sizeof tr->
src.as_u8);
346 sizeof tr->
dst.as_u8);
360 n_left_to_next, bi0, next0);
370 SRV6_AS_REWRITE_COUNTER_PROCESSED,
379 .name =
"srv6-as2-rewrite",
380 .vector_size =
sizeof (
u32),
403 u32 n_left_from, next_index, *from, *to_next;
410 while (n_left_from > 0)
418 while (n_left_from > 0 && n_left_to_next > 0)
447 b0->
error = node->
errors[SRV6_AS_REWRITE_COUNTER_NO_RW];
464 checksum0 = ip0_encap->checksum + clib_host_to_net_u16 (0x0100);
465 checksum0 += checksum0 >= 0xffff;
466 ip0_encap->checksum = checksum0;
470 clib_net_to_host_u16 (ip0_encap->length);
488 sizeof tr->
src.as_u8);
490 sizeof tr->
dst.as_u8);
504 n_left_to_next, bi0, next0);
514 SRV6_AS_REWRITE_COUNTER_PROCESSED,
523 .name =
"srv6-as4-rewrite",
524 .vector_size =
sizeof (
u32),
547 u32 n_left_from, next_index, *from, *to_next;
554 while (n_left_from > 0)
562 while (n_left_from > 0 && n_left_to_next > 0)
590 b0->
error = node->
errors[SRV6_AS_REWRITE_COUNTER_NO_RW];
605 ip0_encap->hop_limit -= 1;
609 clib_net_to_host_u16 (ip0_encap->payload_length);
627 sizeof tr->
src.as_u8);
629 sizeof tr->
dst.as_u8);
643 n_left_to_next, bi0, next0);
653 SRV6_AS_REWRITE_COUNTER_PROCESSED,
662 .name =
"srv6-as6-rewrite",
663 .vector_size =
sizeof (
u32),
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 u8 * format_srv6_as_rewrite_trace(u8 *s, va_list *args)
#define IP_PROTOCOL_IP6_ETHERNET
static uword srv6_as_localsid_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
SRv6 AS Localsid graph node.
static void vlib_increment_combined_counter(vlib_combined_counter_main_t *cm, u32 thread_index, u32 index, u64 n_packets, u64 n_bytes)
Increment a combined counter.
u32 * sw_iface_localsid4
Retrieve local SID from iface.
vlib_node_registration_t srv6_as2_rewrite_node
(constructor) VLIB_REGISTER_NODE (srv6_as2_rewrite_node)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define clib_memcpy_fast(a, b, c)
static char * srv6_as_rewrite_counter_strings[]
#define VLIB_BUFFER_PRE_DATA_SIZE
u16 current_length
Nbytes between current data and the end of this buffer.
u32 * sw_iface_localsid2
Retrieve local SID from iface.
static void * ip6_ext_next_header(ip6_ext_header_t *ext_hdr)
vlib_error_t * errors
Vector of errors for this node.
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
vlib_combined_counter_main_t sr_ls_invalid_counters
vlib_combined_counter_main_t sr_ls_valid_counters
#define static_always_inline
vl_api_interface_index_t sw_if_index
vl_api_fib_path_type_t type
vlib_error_t error
Error code for buffers to be enqueued to error handler.
u32 nh_adj
Adjacency index for out.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static_always_inline void end_as_processing(vlib_buffer_t *b0, ip6_header_t *ip0, srv6_as_localsid_t *ls0_mem, u32 *next0)
Function doing SRH processing for AS behavior.
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_node_registration_t srv6_as6_rewrite_node
(constructor) VLIB_REGISTER_NODE (srv6_as6_rewrite_node)
#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)
#define ip6_ext_header_len(p)
ip6_sr_localsid_t * localsids
#define VLIB_REGISTER_NODE(x,...)
u8 * rewrite
Headers to be rewritten.
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.
vlib_main_t vlib_node_runtime_t * node
static u8 ip6_ext_hdr(u8 nexthdr)
vlib_node_registration_t srv6_as_localsid_node
(constructor) VLIB_REGISTER_NODE (srv6_as_localsid_node)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
u32 sw_if_index_out
Outgoing iface to proxied dev.
void * plugin_mem
Memory to be used by the plugin callback functions.
vlib_combined_counter_main_t invalid_counters
Invalid rewrite counters.
#define foreach_srv6_as_rewrite_counter
static uword srv6_as4_rewrite_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Graph node for applying a SR policy into an IPv6 packet.
vlib_node_registration_t srv6_as4_rewrite_node
(constructor) VLIB_REGISTER_NODE (srv6_as4_rewrite_node)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
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
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u32 * sw_iface_localsid6
Retrieve local SID from iface.
vlib_combined_counter_main_t valid_counters
Valid rewrite counters.
static u8 * format_srv6_as_localsid_trace(u8 *s, va_list *args)
Segment Routing main datastructure.
static uword srv6_as6_rewrite_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Graph node for applying a SR policy into an IPv6 packet.
srv6_as_main_t srv6_as_main
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u16 flags
Copy of main node flags.
static uword srv6_as2_rewrite_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
Graph node for applying a SR policy into an IPv6 packet.
#define VLIB_NODE_FLAG_TRACE
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.