|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
63 lookup_main.if_address_pool_index_by_sw_if_index,
66 lookup_main.if_address_pool_index_by_sw_if_index,
87 sizeof (ip6_address_fib_t));
100 for (
i = 0;
i < 256;
i++)
123 if (flow_hash_config & v) \
124 s = format (s, "%s ", #n);
134 u8 *packet_data = va_arg (*args,
u8 *);
135 u32 n_packet_data_bytes = va_arg (*args,
u32);
157 else if (
unformat (input,
"null-send-unreach"))
159 else if (
unformat (input,
"null-send-prohibit"))
163 else if (
unformat (input,
"classify"))
218 else if (
unformat (line_input,
"%U/%d",
224 else if (
unformat (line_input,
"%U/%d",
230 else if (
unformat (line_input,
"via %U",
235 else if (
vec_len (prefixs) > 0 &&
241 else if (
unformat (line_input,
"del"))
243 else if (
unformat (line_input,
"add"))
285 if (is_del && 0 ==
vec_len (rpaths))
289 else if (!is_del && 1 ==
vec_len (dpos))
302 "Load-balancing over multiple special adjacencies is unsupported");
315 for (k = 0; k < n; k++)
335 clib_host_to_net_u32 (incr +
336 clib_net_to_host_u32 (
dst.
341 int bucket = (incr < 64 ? 0 : 1);
342 dst.ip6.as_u64[bucket] =
343 clib_host_to_net_u64 (incr +
344 clib_net_to_host_u64 (
dst.ip6.as_u64
389 else if (
unformat (line_input,
"del"))
391 else if (
unformat (line_input,
"add"))
477 if (fib_index == (
u32) ~0)
516 .short_help =
"Internet protocol (IP) commands",
523 .short_help =
"Internet protocol version 6 (IPv6) commands",
530 .short_help =
"Internet protocol (IP) show commands",
537 .short_help =
"Internet protocol version 6 (IPv6) show commands",
571 .short_help =
"ip route [add|del] [count <n>] <dst-ip-addr>/<width> [table <table-id>] via [next-hop-address] [next-hop-interface] [next-hop-table <value>] [weight <value>] [preference <value>] [udp-encap-id <value>] [ip4-lookup-in-table <value>] [ip6-lookup-in-table <value>] [mpls-lookup-in-table <value>] [resolve-via-host] [resolve-via-connected] [rx-ip4 <interface>] [out-labels <value value value>]",
586 .short_help =
"ip table [add|del] <table-id>",
601 .short_help =
"ip6 table [add|del] <table-id>",
606 .path =
"show ip table",
607 .short_help =
"show ip table <table-id>",
612 .path =
"show ip6 table",
613 .short_help =
"show ip6 table <table-id>",
648 if (VNET_API_ERROR_ADDRESS_FOUND_FOR_INTERFACE ==
rv)
655 else if (VNET_API_ERROR_NO_SUCH_FIB ==
rv)
706 .path =
"set interface ip table",
708 .short_help =
"set interface ip table <interface> <table-id>",
734 .path =
"set interface ip6 table",
736 .short_help =
"set interface ip6 table <interface> <table-id>"
751 u32 gcount, scount, ss, gg, incr;
770 else if (
unformat (line_input,
"del"))
772 else if (
unformat (line_input,
"add"))
776 else if (
unformat (line_input,
"scount %d", &scount))
778 else if (
unformat (line_input,
"gcount %d", &gcount))
780 else if (
unformat (line_input,
"%U %U",
788 else if (
unformat (line_input,
"%U %U",
796 else if (
unformat (line_input,
"%U/%d",
803 else if (
unformat (line_input,
"%U/%d",
810 else if (
unformat (line_input,
"%U",
817 else if (
unformat (line_input,
"%U",
824 else if (
unformat (line_input,
"via local Forward"))
838 else if (
unformat (line_input,
"via %U",
843 else if (
unformat (line_input,
"%U",
875 incr = 1 << (32 - (pfx.
fp_len % 32));
879 incr = 1 << (128 - (pfx.
fp_len % 128));
882 for (ss = 0; ss < scount; ss++)
884 for (gg = 0; gg < gcount; gg++)
886 if (is_del && 0 ==
vec_len (rpaths))
909 clib_host_to_net_u32 (incr +
910 clib_net_to_host_u32 (pfx.
916 int bucket = (incr < 64 ? 0 : 1);
918 clib_host_to_net_u64 (incr +
919 clib_net_to_host_u64 (pfx.
920 fp_grp_addr.ip6.as_u64
928 clib_host_to_net_u32 (1 +
935 clib_host_to_net_u64 (1 +
943 if (scount > 1 || gcount > 1)
945 (scount * gcount) / (timet[1] - timet[0]));
979 .short_help =
"ip mroute [add|del] <dst-ip-addr>/<width> [table <table-id>] [rpf-id <ID>] [via <next-hop-ip-addr> [<interface>],",
static clib_error_t * ip_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
mhash_t prefix_to_if_prefix_index
Hash table mapping prefix to index in interface prefix pool.
u32 is_ip6
1 for ip6; 0 for ip4.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
u32 frp_mitf_flags
MFIB interface flags.
fib_node_index_t fib_table_entry_special_dpo_add(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, const dpo_id_t *dpo)
Add a 'special' entry to the FIB that links to the DPO passed A special entry is an entry that the FI...
clib_error_t * vnet_ip6_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
@ IP_NULL_ACTION_SEND_ICMP_PROHIBIT
void ip_table_delete(fib_protocol_t fproto, u32 table_id, u8 is_api)
const ip46_address_t zero_addr
#include <vnet/feature/feature.h>
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
u8 frp_weight
[un]equal cost path weight
ip4_main_t ip4_main
Global ip4 main structure.
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
static vlib_cli_command_t set_interface_ip6_table_command
(constructor) VLIB_CLI_COMMAND (set_interface_ip6_table_command)
Aggregate type for a prefix.
u32 fib_result_n_bytes
Number of bytes in a fib result.
u8 * format_ip_flow_hash_config(u8 *s, va_list *args)
#define clib_error_return(e, args...)
@ IP_BUILTIN_PROTOCOL_UNKNOWN
u16 fp_len
The mask length.
ip46_address_t frp_addr
The next-hop address.
u16 fp_len
The mask length.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
u32 frp_sw_if_index
The interface.
enum mfib_entry_flags_t_ mfib_entry_flags_t
@ FIB_ENTRY_FLAG_EXCLUSIVE
index_t classify_dpo_create(dpo_proto_t proto, u32 classify_table_index)
dpo_proto_t frp_proto
The protocol of the address below.
__clib_export void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
u32 ip_table_get_unused_id(fib_protocol_t fproto)
ip46_address_t fp_src_addr
A protocol Independent FIB table.
#define pool_foreach(VAR, POOL)
Iterate through pool.
static clib_error_t * ip6_table_bind_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * vnet_ip_mroute_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
void ip_lookup_init(ip_lookup_main_t *lm, u32 is_ip6)
fib_node_index_t ft_index
Index into FIB vector.
mhash_t address_to_if_address_index
Hash table mapping address to index in interface address pool.
vnet_main_t * vnet_get_main(void)
u32 ft_table_id
Table ID (hash key) for this FIB.
u8 * ft_desc
Table description.
static vlib_cli_command_t ip6_table_command
(constructor) VLIB_CLI_COMMAND (ip6_table_command)
clib_error_t * vnet_show_ip6_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
enum flow_hash_config_t_ flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
clib_error_t * vnet_show_ip_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd, fib_protocol_t fproto)
uword unformat_mfib_entry_flags(unformat_input_t *input, va_list *args)
if(node->flags &VLIB_NODE_FLAG_TRACE) vnet_interface_output_trace(vm
clib_error_t * vnet_ip_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd, fib_protocol_t fproto)
@ IP_BUILTIN_PROTOCOL_UDP
static uword unformat_dpo(unformat_input_t *input, va_list *args)
struct fib_table_t_ * fibs
#define VLIB_CLI_COMMAND(x,...)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static vlib_cli_command_t ip4_table_command
(constructor) VLIB_CLI_COMMAND (ip4_table_command)
fib_protocol_t fp_proto
protocol type
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
void ip_table_create(fib_protocol_t fproto, u32 table_id, u8 is_api, const u8 *name)
static clib_error_t * ip_table_bind_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd, fib_protocol_t fproto)
static vlib_cli_command_t set_interface_ip_table_command
(constructor) VLIB_CLI_COMMAND (set_interface_ip_table_command)
static vlib_cli_command_t ip_route_command
(constructor) VLIB_CLI_COMMAND (ip_route_command)
@ IP_NULL_ACTION_SEND_ICMP_UNREACH
#define vec_free(V)
Free vector's memory (no header).
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
fib_route_path_flags_t frp_flags
flags on the path
fib_node_index_t fib_table_entry_path_add2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_entry_flag_t flags, fib_route_path_t *rpaths)
Add n paths to an entry (aka route) in the FIB.
u32 mfib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
format_function_t format_vnet_sw_if_index_name
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
int ip_table_bind(fib_protocol_t fproto, u32 sw_if_index, u32 table_id, u8 is_api)
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
fib_table_t * fib_table_get(fib_node_index_t index, fib_protocol_t proto)
Get a pointer to a FIB table.
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(ip_sw_interface_add_del)
struct fib_table_t_ * fibs
Vector of FIBs.
@ IP_BUILTIN_PROTOCOL_ICMP
void fib_table_entry_path_remove2(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source, fib_route_path_t *rpaths)
Remove n paths to an entry (aka route) in the FIB.
A representation of a path as described by a route producer.
const dpo_id_t * punt_dpo_get(dpo_proto_t proto)
static clib_error_t * ip4_table_bind_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
@ FIB_SOURCE_CLI
From the CLI.
static vlib_cli_command_t vlib_cli_show_ip6_command
(constructor) VLIB_CLI_COMMAND (vlib_cli_show_ip6_command)
@ IP_LOCAL_NEXT_UDP_LOOKUP
fib_protocol_t fp_proto
protocol type
void mfib_table_entry_path_remove(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Remove n paths to an entry (aka route) in the FIB.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
void receive_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, const ip46_address_t *nh_addr, dpo_id_t *dpo)
u8 local_next_by_ip_protocol[256]
Table mapping ip protocol to ip[46]-local node next index.
static vlib_cli_command_t show_ip6_table_command
(constructor) VLIB_CLI_COMMAND (show_ip6_table_command)
clib_error_t * vnet_ip4_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
format_function_t * format_address_and_length
Either format_ip4_address_and_length or format_ip6_address_and_length.
static vlib_cli_command_t vlib_cli_ip_command
(constructor) VLIB_CLI_COMMAND (vlib_cli_ip_command)
fib_node_index_t mfib_table_entry_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, fib_rpf_id_t rpf_id, mfib_entry_flags_t entry_flags)
Add a new (with no replication) or lock an existing entry.
fib_node_index_t mfib_table_entry_path_update(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source, const fib_route_path_t *rpath)
Add n paths to an entry (aka route) in the FIB.
u8 builtin_protocol_by_ip_protocol[256]
IP_BUILTIN_PROTOCOL_{TCP,UDP,ICMP,OTHER} by protocol in IP header.
#define clib_warning(format, args...)
clib_error_t * vnet_show_ip4_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
void ip_null_dpo_add_and_lock(dpo_proto_t proto, ip_null_dpo_action_t action, dpo_id_t *dpo)
static vlib_cli_command_t vlib_cli_show_ip_command
(constructor) VLIB_CLI_COMMAND (vlib_cli_show_ip_command)
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
static f64 vlib_time_now(vlib_main_t *vm)
static vlib_cli_command_t ip_mroute_command
(constructor) VLIB_CLI_COMMAND (ip_mroute_command)
void dpo_set(dpo_id_t *dpo, dpo_type_t type, dpo_proto_t proto, index_t index)
Set/create a DPO ID The DPO will be locked.
u8 * format_ip_adjacency_packet_data(u8 *s, va_list *args)
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
vl_api_interface_index_t sw_if_index
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
uword unformat_fib_route_path(unformat_input_t *input, va_list *args)
Unformat a fib_route_path_t from CLI input.
Aggregate type for a prefix.
@ FIB_ROUTE_PATH_LOCAL
A for-us/local path.
void mfib_table_entry_delete(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source)
Delete a FIB entry.
static vlib_cli_command_t vlib_cli_ip6_command
(constructor) VLIB_CLI_COMMAND (vlib_cli_ip6_command)
static vlib_cli_command_t show_ip4_table_command
(constructor) VLIB_CLI_COMMAND (show_ip4_table_command)
static clib_error_t * vnet_ip_route_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)