21 #include <openssl/hmac.h> 75 for (i = 0; i <= first_segment; i++)
90 if (!HMAC_Final(sm->
hmac_ctx, (
unsigned char *) addrp, &sig_len))
99 int bswap_needed = va_arg (*args,
int);
103 flags = clib_host_to_net_u16 (flags);
106 s =
format (s,
"cleanup ");
109 s =
format (s,
"reroute ");
112 for (i = 1; i <= 4; i++)
115 s =
format (s,
"[%d] ", i);
130 s =
format (s,
"OrgSrc ");
140 int print_hmac = va_arg (*args,
int);
141 int i, pl_index, max_segs;
142 int flags_host_byte_order = clib_net_to_host_u16(h->
flags);
144 s =
format (s,
"next proto %d, len %d, type %d",
146 s =
format (s,
"\n segs left %d, first_segment %d, hmac key %d",
149 flags_host_byte_order, 0 );
156 max_segs = (h->
length>>1);
161 s =
format (s,
"\n Segments (in processing order):");
166 s =
format (s,
"\n Policy List:");
169 for (i = (h->
first_segment+1); i < max_segs; i++, pl_index++)
172 char * tags[] = {
" ",
"InPE: ",
"EgPE: ",
"OrgSrc: "};
175 if (pl_index >=1 && pl_index <= 4)
178 (flags_host_byte_order, pl_index);
179 tag = tags[this_pl_flag];
191 u32 max_header_bytes = va_arg (*args,
u32);
195 if (max_header_bytes != 0 && header_bytes > max_header_bytes)
196 return format (s,
"ip6_sr header truncated");
200 0 , max_header_bytes);
205 #define foreach_sr_rewrite_next \ 206 _(ERROR, "error-drop") \ 207 _(IP6_LOOKUP, "ip6-lookup") \ 208 _(SR_LOCAL, "sr-local") \ 209 _(SR_REPLICATE,"sr-replicate") 211 #define foreach_sr_rewrite_next \ 212 _(ERROR, "error-drop") \ 213 _(IP6_LOOKUP, "ip6-lookup") \ 214 _(SR_LOCAL, "sr-local") 218 #define _(s,n) SR_REWRITE_NEXT_##s, 233 #define sr_error(n,s) s, 239 #define sr_error(n,s) SR_REWRITE_ERROR_##n, 263 (s,
"SR-REWRITE: next %s ip6 src %U dst %U len %u\n" 264 " rx-fib-id %d tx-fib-id %d\n%U",
266 ?
"sr-local" :
"ip6-lookup",
279 u32 n_left_from, next_index, * from, * to_next;
293 while (n_left_from > 0)
298 to_next, n_left_to_next);
301 while (0 && n_left_from >= 4 && n_left_to_next >= 2)
304 vlib_buffer_t * b0, * b1;
305 ip6_header_t * ip0, * ip1;
309 u32 next0 = SR_REWRITE_NEXT_IP6_LOOKUP;
310 u32 next1 = SR_REWRITE_NEXT_IP6_LOOKUP;
316 vlib_buffer_t * p2, * p3;
345 adj0->rewrite_header.sw_if_index);
347 adj1->rewrite_header.sw_if_index);
370 next0 = SR_REWRITE_NEXT_SR_LOCAL;
380 ip0, sizeof (ip6_header_t));
403 next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) :
414 node->
errors[SR_REWRITE_ERROR_APP_CALLBACK];
423 next1 = SR_REWRITE_NEXT_SR_LOCAL;
428 ip0, sizeof (ip6_header_t));
449 next1 = sr_local_cb ? sr_local_cb (vm, node, b1, ip1, sr1) :
460 node->
errors[SR_REWRITE_ERROR_APP_CALLBACK];
492 to_next, n_left_to_next,
493 bi0, bi1, next0, next1);
496 while (n_left_from > 0 && n_left_to_next > 0)
500 ip6_header_t * ip0 = 0;
504 u32 next0 = SR_REWRITE_NEXT_IP6_LOOKUP;
523 adj0->rewrite_header.sw_if_index);
530 next0=SR_REWRITE_NEXT_SR_REPLICATE;
552 next0 = SR_REWRITE_NEXT_SR_LOCAL;
562 ip0, sizeof (ip6_header_t));
585 next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) :
596 node->
errors[SR_REWRITE_ERROR_APP_CALLBACK];
621 to_next, n_left_to_next,
632 .name =
"sr-rewrite",
634 .vector_size =
sizeof (
u32),
638 .n_errors = SR_REWRITE_N_ERROR,
639 .error_strings = sr_rewrite_error_strings,
641 .runtime_data_bytes = 0,
645 #define _(s,n) [SR_REWRITE_NEXT_##s] = n, 652 u32 dst_address_length,
659 BVT(clib_bihash_kv) kv, value;
663 memset (&a, 0,
sizeof (a));
667 dst_address = *dst_address_arg;
672 kv.key[0] = dst_address.
as_u64[0];
673 kv.key[1] = dst_address.
as_u64[1];
674 kv.key[2] = ((
u64)((fib - im6->
fibs))<<32) | dst_address_length;
710 if (indexp && *indexp)
754 u32 rx_fib_index, tx_fib_index;
756 u32 hmac_key_index_u32;
757 u8 hmac_key_index = 0;
846 clib_warning (
"Tunnel index %d not found in policy_index %d",
866 key_copy = (
void *)(hp->
key);
874 memset (t, 0,
sizeof (*t));
894 header_length =
sizeof (*h) +
900 hmac_key_index_u32 = 0;
902 &hmac_key_index_u32);
905 if (hmac_key_index_u32 >= 256)
907 hmac_key_index = hmac_key_index_u32;
908 header_length += SHA256_DIGEST_LENGTH;
917 h->
length = (header_length/8) - 1;
928 h->
hmac_key = hmac_key_index & 0xFF;
963 memset(&adj, 0,
sizeof (adj));
984 ap->rewrite_header.sw_if_index = t - sm->
tunnels;
1010 memset (pt, 0,
sizeof(*pt));
1035 int src_address_set = 0;
1038 int dst_address_set = 0;
1040 u8 *shared_secret = 0;
1042 u8 *policy_name = 0;
1043 u32 rx_table_id = 0;
1044 u32 tx_table_id = 0;
1058 else if (
unformat (input,
"rx-fib-id %d", &rx_table_id))
1060 else if (
unformat (input,
"tx-fib-id %d", &tx_table_id))
1063 src_address_set = 1;
1064 else if (
unformat (input,
"name %s", &name))
1066 else if (
unformat (input,
"policy %s", &policy_name))
1068 else if (
unformat (input,
"dst %U/%d",
1071 dst_address_set = 1;
1084 else if (
unformat (input,
"clean"))
1086 else if (
unformat (input,
"protected"))
1088 else if (
unformat (input,
"key %s", &shared_secret))
1090 _vec_len (shared_secret) -= 1;
1091 else if (
unformat (input,
"InPE %d", &pl_index))
1093 if (pl_index <= 0 || pl_index > 4)
1095 pl_index_range_error:
1097 (0,
"Policy List Element Index %d out of range (1-4)", pl_index);
1103 else if (
unformat (input,
"EgPE %d", &pl_index))
1105 if (pl_index <= 0 || pl_index > 4)
1106 goto pl_index_range_error;
1110 else if (
unformat (input,
"OrgSrc %d", &pl_index))
1112 if (pl_index <= 0 || pl_index > 4)
1113 goto pl_index_range_error;
1121 if (!src_address_set)
1124 if (!dst_address_set)
1130 memset (a, 0,
sizeof (*a));
1188 .path =
"sr tunnel",
1190 "sr tunnel [del] [name <name>] src <addr> dst <addr> [next <addr>] " 1191 "[clean] [reroute] [key <secret>] [policy <policy_name>]" 1192 "[rx-fib-id <fib_id>] [tx-fib-id <fib_id>]",
1247 if (
unformat (input,
"name %s", &name))
1251 vlib_cli_output (vm,
"No SR tunnel with name: %s. Showing all.", name);
1263 vec_add1 (tunnels, t);
1272 for (i = 0; i <
vec_len (tunnels); i++)
1282 .path =
"show sr tunnel",
1283 .short_help =
"show sr tunnel [name <sr-tunnel-name>]",
1293 u32 * tunnel_indices = 0;
1365 u8 ** tunnel_names = 0;
1366 u8 * tunnel_name = 0;
1375 else if (
unformat (input,
"name %s", &name))
1377 else if (
unformat (input,
"tunnel %s", &tunnel_name))
1381 vec_add1 (tunnel_names, tunnel_name);
1393 memset(a, 0,
sizeof(*a));
1409 return clib_error_return (0,
"tunnel name to associate to SR policy is required");
1431 .path =
"sr policy",
1433 "sr policy [del] name <policy-name> tunnel <sr-tunnel-name> [tunnel <sr-tunnel-name>]*",
1452 if (
unformat (input,
"name %s", &name))
1456 vlib_cli_output (vm,
"policy with name %s not found. Showing all.", name);
1468 vec_add1 (policies, policy);
1480 for (i = 0; i <
vec_len (policies); i++)
1482 policy = policies [
i];
1498 .path =
"show sr policy",
1499 .short_help =
"show sr policy [name <sr-policy-name>]",
1541 memset(&adj, 0,
sizeof (adj));
1561 ap->rewrite_header.sw_if_index = t - sm->
tunnels;
1577 u8 * mcast_copy = 0;
1602 u8 * policy_name = 0;
1603 int multicast_address_set = 0;
1612 multicast_address_set = 1;
1613 else if (
unformat (input,
"sr-policy %s", &policy_name))
1619 if (!is_del && !policy_name)
1622 if (!multicast_address_set)
1625 memset(a, 0,
sizeof(*a));
1634 return clib_error_return (0,
"cannot use multicast replicate spray case without DPDK installed");
1648 return clib_error_return (0,
"tunnel name to associate to SR policy is required");
1663 .path =
"sr multicast-map",
1665 "sr multicast-map address <multicast-ip6-address> sr-policy <sr-policy-name> [del]",
1685 vlib_cli_output (vm,
"no multicast maps configured");
1688 multicast_address = *((ip6_address_t *)key);
1689 pt = pool_elt_at_index (sm->policies, value);
1692 vlib_cli_output (vm,
"address: %U policy: %s",
1693 format_ip6_address, &multicast_address,
1697 vlib_cli_output (vm,
"BUG: policy not found for address: %U with policy index %d",
1698 format_ip6_address, &multicast_address,
1709 .path =
"show sr multicast-map",
1710 .short_help =
"show sr multicast-map",
1715 #define foreach_sr_fix_dst_addr_next \ 1716 _(DROP, "error-drop") 1719 #define _(s,n) SR_FIX_DST_ADDR_NEXT_##s, 1725 static char * sr_fix_dst_error_strings[] = {
1726 #define sr_fix_dst_error(n,s) s, 1728 #undef sr_fix_dst_error 1732 #define sr_fix_dst_error(n,s) SR_FIX_DST_ERROR_##n, 1734 #undef sr_fix_dst_error 1762 s =
format (s,
"SR-FIX_ADDR: next %s ip6 src %U dst %U\n",
1764 ?
"drop" :
"output",
1767 if (t->
next_index != SR_FIX_DST_ADDR_NEXT_DROP)
1770 s =
format (s,
" output via %s", hi ? (
char *)(hi->
name)
1781 u32 n_left_from, next_index, * from, * to_next;
1790 while (n_left_from > 0)
1795 to_next, n_left_to_next);
1798 while (0 && n_left_from >= 4 && n_left_to_next >= 2)
1802 u32 next0 = SR_FIX_DST_ADDR_NEXT_DROP;
1803 u32 next1 = SR_FIX_DST_ADDR_NEXT_DROP;
1822 n_left_to_next -= 2;
1830 to_next, n_left_to_next,
1831 bi0, bi1, next0, next1);
1835 while (n_left_from > 0 && n_left_to_next > 0)
1842 u32 next0 = SR_FIX_DST_ADDR_NEXT_DROP;
1851 n_left_to_next -= 1;
1866 b0->
error = node->
errors[SR_FIX_DST_ERROR_NO_SR_HEADER];
1880 b0->
error = node->
errors[SR_FIX_DST_ERROR_NO_MORE_SEGMENTS];
1904 if (next0 != SR_FIX_DST_ADDR_NEXT_DROP)
1916 to_next, n_left_to_next,
1928 .name =
"sr-fix-dst-addr",
1930 .vector_size =
sizeof (
u32),
1934 .runtime_data_bytes = 0,
1936 .n_errors = SR_FIX_DST_N_ERROR,
1937 .error_strings = sr_fix_dst_error_strings,
1941 #define _(s,n) [SR_FIX_DST_ADDR_NEXT_##s] = n, 1953 u32 verify_next_index;
1987 ASSERT(ip6_rewrite_node);
1990 (
u8 *)
"ip6-rewrite-local");
1991 ASSERT(ip6_rewrite_local_node);
2012 (vm, ip6_rewrite_local_node->
index,
2017 OpenSSL_add_all_digests();
2019 sm->
md = (
void *) EVP_get_digestbyname (
"sha1");
2027 #define foreach_sr_local_next \ 2028 _ (ERROR, "error-drop") \ 2029 _ (IP6_LOOKUP, "ip6-lookup") 2032 #define _(s,n) SR_LOCAL_NEXT_##s, 2047 #define sr_error(n,s) s, 2053 #define sr_error(n,s) SR_LOCAL_ERROR_##n, 2065 s =
format (s,
"SR-LOCAL: src %U dst %U len %u next_index %d",
2071 s =
format (s,
"\n popped SR header");
2089 static u8 * signature;
2131 for (i = 0; i <= first_segment; i++)
2139 clib_warning (
"verify key index %d keybuf: %U", key_index,
2145 memset (signature, 0,
vec_len(signature));
2153 if (!HMAC_Final(sm->
hmac_ctx,signature,&sig_len))
2158 clib_warning (
"computed signature len %d, value %U", sig_len,
2165 SHA256_DIGEST_LENGTH);
2167 return memcmp (signature, addrp, SHA256_DIGEST_LENGTH);
2175 u32 n_left_from, next_index, * from, * to_next;
2187 while (n_left_from > 0)
2192 to_next, n_left_to_next);
2194 while (n_left_from >= 4 && n_left_to_next >= 2)
2197 vlib_buffer_t * b0, * b1;
2198 ip6_header_t * ip0, *ip1;
2201 u32 next0 = SR_LOCAL_NEXT_IP6_LOOKUP;
2202 u32 next1 = SR_LOCAL_NEXT_IP6_LOOKUP;
2205 vlib_buffer_t * p2, * p3;
2223 n_left_to_next -= 2;
2233 next0 = SR_LOCAL_NEXT_ERROR;
2234 b0->
error = node->
errors[SR_LOCAL_ERROR_BAD_ROUTING_HEADER_TYPE];
2241 next0 = SR_LOCAL_NEXT_ERROR;
2242 b0->
error = node->
errors[SR_LOCAL_ERROR_NO_MORE_SEGMENTS];
2250 next0 = SR_LOCAL_NEXT_ERROR;
2251 b0->
error = node->
errors[SR_LOCAL_ERROR_HMAC_INVALID];
2256 next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) :
2264 next0 ^= 0xFFFFFFFF;
2267 node->
errors[SR_LOCAL_ERROR_APP_CALLBACK];
2289 u64 *copy_dst0, *copy_src0;
2304 copy_src0 = (
u64 *)ip0;
2305 copy_dst0 = copy_src0 + (sr0->
length + 1);
2307 copy_dst0 [4] = copy_src0[4];
2308 copy_dst0 [3] = copy_src0[3];
2309 copy_dst0 [2] = copy_src0[2];
2310 copy_dst0 [1] = copy_src0[1];
2311 copy_dst0 [0] = copy_src0[0];
2338 next1 = SR_LOCAL_NEXT_ERROR;
2339 b1->
error = node->
errors[SR_LOCAL_ERROR_BAD_ROUTING_HEADER_TYPE];
2346 next1 = SR_LOCAL_NEXT_ERROR;
2347 b1->
error = node->
errors[SR_LOCAL_ERROR_NO_MORE_SEGMENTS];
2355 next1 = SR_LOCAL_NEXT_ERROR;
2356 b1->
error = node->
errors[SR_LOCAL_ERROR_HMAC_INVALID];
2361 next1 = sr_local_cb ? sr_local_cb (vm, node, b1, ip1, sr1) :
2369 next1 ^= 0xFFFFFFFF;
2372 node->
errors[SR_LOCAL_ERROR_APP_CALLBACK];
2394 u64 *copy_dst1, *copy_src1;
2409 copy_src1 = (
u64 *)ip1;
2410 copy_dst1 = copy_src1 + (sr1->
length + 1);
2412 copy_dst1 [4] = copy_src1[4];
2413 copy_dst1 [3] = copy_src1[3];
2414 copy_dst1 [2] = copy_src1[2];
2415 copy_dst1 [1] = copy_src1[1];
2416 copy_dst1 [0] = copy_src1[0];
2438 to_next, n_left_to_next,
2439 bi0, bi1, next0, next1);
2442 while (n_left_from > 0 && n_left_to_next > 0)
2446 ip6_header_t * ip0 = 0;
2449 u32 next0 = SR_LOCAL_NEXT_IP6_LOOKUP;
2456 n_left_to_next -= 1;
2464 next0 = SR_LOCAL_NEXT_ERROR;
2465 b0->
error = node->
errors[SR_LOCAL_ERROR_BAD_ROUTING_HEADER_TYPE];
2472 next0 = SR_LOCAL_NEXT_ERROR;
2473 b0->
error = node->
errors[SR_LOCAL_ERROR_NO_MORE_SEGMENTS];
2481 next0 = SR_LOCAL_NEXT_ERROR;
2482 b0->
error = node->
errors[SR_LOCAL_ERROR_HMAC_INVALID];
2487 next0 = sr_local_cb ? sr_local_cb (vm, node, b0, ip0, sr0) :
2495 next0 ^= 0xFFFFFFFF;
2498 node->
errors[SR_LOCAL_ERROR_APP_CALLBACK];
2520 u64 *copy_dst0, *copy_src0;
2535 copy_src0 = (
u64 *)ip0;
2536 copy_dst0 = copy_src0 + (sr0->
length + 1);
2538 copy_dst0 [4] = copy_src0[4];
2539 copy_dst0 [3] = copy_src0[3];
2540 copy_dst0 [2] = copy_src0[2];
2541 copy_dst0 [1] = copy_src0[1];
2542 copy_dst0 [0] = copy_src0[0];
2564 to_next, n_left_to_next,
2571 SR_LOCAL_ERROR_PKTS_PROCESSED,
2580 .vector_size =
sizeof (
u32),
2583 .runtime_data_bytes = 0,
2585 .n_errors = SR_LOCAL_N_ERROR,
2586 .error_strings = sr_local_error_strings,
2590 #define _(s,n) [SR_LOCAL_NEXT_##s] = n, 2626 if (
unformat (input,
"rx-table-id %d", &fib_id))
2648 sw_if_index = adj->rewrite_header.sw_if_index;
2660 .path =
"set ip6 sr rewrite",
2661 .short_help =
"set ip6 sr rewrite <ip6-address> [fib-id <id>]",
2679 if (
unformat (input,
"validate on"))
2681 else if (
unformat (input,
"chunk-offset off"))
2694 .path =
"test sr hmac",
2695 .short_help =
"test sr hmac validate [on|off]",
2749 u8 * shared_secret = 0;
2756 else if (
unformat (input,
"id %d", &key_id))
2758 else if (
unformat (input,
"key %s", &shared_secret))
2761 _vec_len (shared_secret) -= 1;
2767 if (is_del == 0 && shared_secret == 0)
2770 if (shared_secret == 0 && key_id_set == 0)
2792 .short_help =
"sr hmac [del] id <nn> key <str>",
2815 .path =
"show sr hmac",
2816 .short_help =
"show sr hmac",
2841 .path =
"test sr debug",
2842 .short_help =
"test sr debug on|off",
static int ip6_delete_route_no_next_hop(ip6_address_t *dst_address_arg, u32 dst_address_length, u32 rx_table_id)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
vlib_cli_command_t test_sr_debug
(constructor) VLIB_CLI_COMMAND (test_sr_debug)
#define vec_foreach_index(var, v)
Iterate over vector indices.
sll srl srl sll sra u16x4 i
static char * sr_rewrite_error_strings[]
uword * tunnel_index_by_key
#define IP6_SR_HEADER_FLAG_PL_ELT_EGRESS_PE
void ip6_register_protocol(u32 protocol, u32 node_index)
static void(BVT(clib_bihash)*h, BVT(clib_bihash_value)*v)
#define IP6_SR_HEADER_FLAG_PROTECTED
ip6_address_t * multicast_address
ip_lookup_next_t lookup_next_index
u8 * format_sr_rewrite_trace(u8 *s, va_list *args)
static clib_error_t * test_sr_hmac_validate_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void ip6_sr_tunnel_display(vlib_main_t *vm, ip6_sr_tunnel_t *t)
int ip6_sr_add_del_policy(ip6_sr_add_del_policy_args_t *a)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
vlib_node_registration_t ip6_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip6_rewrite_node)
ip_adjacency_t * ip_add_adjacency(ip_lookup_main_t *lm, ip_adjacency_t *copy_adj, u32 n_adj, u32 *adj_index_return)
struct _vlib_node_registration vlib_node_registration_t
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
vlib_cli_command_t show_sr_tunnel_command
(constructor) VLIB_CLI_COMMAND (show_sr_tunnel_command)
#define hash_set_mem(h, key, value)
i32 sr_hmac_add_del_key(ip6_sr_main_t *sm, u32 key_id, u8 *shared_secret, u8 is_del)
#define ROUTING_HEADER_TYPE_SR
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static clib_error_t * sr_add_del_policy_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ip6_sr_main_t * sr_get_main(vlib_main_t *vm)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
int ip6_sr_add_del_multicastmap(ip6_sr_add_del_multicastmap_args_t *a)
u8 * format_ip6_sr_header_flags(u8 *s, va_list *args)
vnet_main_t * vnet_get_main(void)
static vlib_node_registration_t sr_local_node
(constructor) VLIB_REGISTER_NODE (sr_local_node)
static uword sr_rewrite(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static uword sr_local(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
#define pool_foreach(VAR, POOL, BODY)
#define VLIB_INIT_FUNCTION(x)
ip6_sr_hmac_key_t * hmac_keys
#define vec_new(T, N)
Create new vector of given type and length (unspecified alignment, no header).
vlib_cli_command_t test_sr_hmac_validate
(constructor) VLIB_CLI_COMMAND (test_sr_hmac_validate)
ip6_fib_t * find_ip6_fib_by_table_index_or_id(ip6_main_t *im, u32 table_index_or_id, u32 flags)
Get or create an IPv6 fib.
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vlib_cli_command_t show_sr_hmac
(constructor) VLIB_CLI_COMMAND (show_sr_hmac)
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
vlib_cli_command_t show_sr_policy_command
(constructor) VLIB_CLI_COMMAND (show_sr_policy_command)
#define clib_warning(format, args...)
u32 table_index_or_table_id
vlib_cli_command_t sr_multicast_map_command
(constructor) VLIB_CLI_COMMAND (sr_multicast_map_command)
#define hash_get_pair(h, key)
#define IPPROTO_IPV6_ROUTE
#define vlib_call_init_function(vm, x)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
#define foreach_sr_rewrite_next
void ip6_add_del_route(ip6_main_t *im, ip6_add_del_route_args_t *args)
#define IP6_SR_HEADER_FLAG_CLEANUP
static clib_error_t * sr_add_del_tunnel_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define hash_create_string(elts, value_bytes)
int BV() clib_bihash_search(BVT(clib_bihash)*h, BVT(clib_bihash_kv)*search_key, BVT(clib_bihash_kv)*valuep)
vlib_cli_command_t sr_policy_command
(constructor) VLIB_CLI_COMMAND (sr_policy_command)
static clib_error_t * test_sr_debug_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_BUFFER_PRE_DATA_SIZE
ip6_address_t dst_address
#define hash_create_mem(elts, key_bytes, value_bytes)
#define pool_elt_at_index(p, i)
#define hash_unset_mem(h, key)
static char * sr_local_error_strings[]
void ip6_maybe_remap_adjacencies(ip6_main_t *im, u32 table_index_or_table_id, u32 flags)
u8 * format_sr_fix_addr_trace(u8 *s, va_list *args)
#define vec_dup(V)
Return copy of vector (no header, no alignment)
u8 * format_ip6_sr_header_with_length(u8 *s, va_list *args)
void vnet_register_sr_app_callback(void *cb)
always_inline void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static clib_error_t * sr_hmac_add_del_key_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 ip6_lookup_sr_replicate_index
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
int ip6_sr_add_del_tunnel(ip6_sr_add_del_tunnel_args_t *a)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
#define hash_foreach_mem(key_var, value_var, h, body)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
uword * fib_index_by_table_id
ip6_address_t * src_address
ip6_address_t fib_masks[129]
clib_error_t * ip_main_init(vlib_main_t *vm)
always_inline void * clib_mem_alloc(uword size)
#define CLIB_PREFETCH(addr, size, type)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * show_sr_multicast_map_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define clib_memcpy(a, b, c)
always_inline vnet_hw_interface_t * vnet_get_sup_hw_interface(vnet_main_t *vnm, u32 sw_if_index)
u32 ip6_fib_lookup_with_table(ip6_main_t *im, u32 fib_index, ip6_address_t *dst)
#define IP6_ROUTE_FLAG_DEL
#define IP6_SR_HEADER_FLAG_PL_ELT_ORIG_SRC_ADDR
#define IP6_SR_HEADER_FLAG_PL_ELT_NOT_PRESENT
static clib_error_t * show_sr_hmac_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
void sr_fix_hmac(ip6_sr_main_t *sm, ip6_header_t *ip, ip6_sr_header_t *sr)
#define IP4_ROUTE_FLAG_DEL
vlib_cli_command_t sr_tunnel_command
(constructor) VLIB_CLI_COMMAND (sr_tunnel_command)
#define VLIB_CLI_COMMAND(x,...)
u8 * format_ip6_sr_header(u8 *s, va_list *args)
static ip6_sr_hmac_key_t * find_or_add_shared_secret(ip6_sr_main_t *sm, u8 *secret, u32 *indexp)
vlib_node_registration_t ip6_lookup_node
(constructor) VLIB_REGISTER_NODE (ip6_lookup_node)
vlib_cli_command_t sr_hmac
(constructor) VLIB_CLI_COMMAND (sr_hmac)
ip_lookup_main_t lookup_main
#define vec_delete(V, N, M)
Delete N elements starting at element M.
static clib_error_t * sr_init(vlib_main_t *vm)
static uword sr_fix_dst_addr(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
ip6_sr_tunnel_t * tunnels
static int sr_validate_hmac(ip6_sr_main_t *sm, ip6_header_t *ip, ip6_sr_header_t *sr)
#define foreach_sr_local_next
uword * policy_index_by_policy_name
uword * tunnel_index_by_name
vlib_node_registration_t sr_fix_dst_addr_node
(constructor) VLIB_REGISTER_NODE (sr_fix_dst_addr_node)
static clib_error_t * show_sr_policy_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
always_inline uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
static clib_error_t * set_ip6_sr_rewrite_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_BUFFER_IS_TRACED
vlib_cli_command_t set_ip6_sr_rewrite
(constructor) VLIB_CLI_COMMAND (set_ip6_sr_rewrite)
#define IP6_SR_HEADER_FLAG_PL_ELT_INGRESS_PE
#define IP6_ROUTE_FLAG_FIB_INDEX
static clib_error_t * sr_add_del_multicast_map_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
always_inline ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
u32 ip6_lookup_sr_next_index
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
uword * hmac_key_by_shared_secret
uword * policy_index_by_multicast_address
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
ip6_sr_policy_t * policies
ip6_address_t * dst_address
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static int ip6_sr_policy_list_shift_from_index(int pl_index)
#define hash_get_mem(h, key)
vlib_node_registration_t ip6_rewrite_local_node
(constructor) VLIB_REGISTER_NODE (ip6_rewrite_local_node)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static clib_error_t * show_sr_tunnel_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_REGISTER_NODE(x,...)
#define IP6_ROUTE_FLAG_ADD
#define vec_foreach(var, vec)
Vector iterator.
u8 * format_sr_local_trace(u8 *s, va_list *args)
#define foreach_sr_fix_dst_addr_next
always_inline void ip6_address_mask(ip6_address_t *a, ip6_address_t *mask)
#define clib_error_return(e, args...)
#define IP6_ROUTE_FLAG_TABLE_ID
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vlib_node_registration_t sr_rewrite_node
(constructor) VLIB_REGISTER_NODE (sr_rewrite_node)
static int ip6_sr_policy_list_flags(u16 flags_host_byte_order, int pl_index)
u32 ip6_rewrite_sr_next_index