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++)
122 #define _(n,v) if (flow_hash_config & v) s = format (s, "%s ", #n); 132 u8 *packet_data = va_arg (*args,
u8 *);
133 u32 n_packet_data_bytes = va_arg (*args,
u32);
155 else if (
unformat (input,
"null-send-unreach"))
157 else if (
unformat (input,
"null-send-prohibit"))
161 else if (
unformat (input,
"classify"))
165 if (!
unformat (input,
"%d", &classify_table_index))
211 if (
unformat (line_input,
"table %d", &table_id))
213 else if (
unformat (line_input,
"count %f", &count))
216 else if (
unformat (line_input,
"%U/%d",
222 else if (
unformat (line_input,
"%U/%d",
228 else if (
unformat (line_input,
"via %U",
233 else if (
vec_len (prefixs) > 0 &&
239 else if (
unformat (line_input,
"del"))
241 else if (
unformat (line_input,
"add"))
281 for (i = 0; i <
vec_len (prefixs); i++)
283 if (is_del && 0 == vec_len (rpaths))
287 else if (!is_del && 1 == vec_len (dpos))
296 else if (vec_len (dpos) > 0)
300 "Load-balancing over multiple special adjacencies is unsupported");
303 else if (0 < vec_len (rpaths))
313 for (k = 0; k < n; k++)
333 clib_host_to_net_u32 (incr +
334 clib_net_to_host_u32 (dst.
339 int bucket = (incr < 64 ? 0 : 1);
340 dst.ip6.as_u64[bucket] =
341 clib_host_to_net_u64 (incr +
342 clib_net_to_host_u64 (dst.ip6.as_u64
385 if (
unformat (line_input,
"%d", &table_id))
387 else if (
unformat (line_input,
"del"))
389 else if (
unformat (line_input,
"add"))
391 else if (
unformat (line_input,
"name %s", &name))
405 else if (0 == table_id)
444 .short_help =
"Internet protocol (IP) commands",
451 .short_help =
"Internet protocol version 6 (IPv6) commands",
458 .short_help =
"Internet protocol (IP) show commands",
465 .short_help =
"Internet protocol version 6 (IPv6) show commands",
499 .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>]",
514 .short_help =
"ip table [add|del] <table-id>",
529 .short_help =
"ip6 table [add|del] <table-id>",
553 if (
unformat (input,
"%d", &table_id))
564 if (VNET_API_ERROR_ADDRESS_FOUND_FOR_INTERFACE == rv)
571 else if (VNET_API_ERROR_NO_SUCH_FIB == rv)
622 .path =
"set interface ip table",
624 .short_help =
"set interface ip table <interface> <table-id>",
650 .path =
"set interface ip6 table",
652 .short_help =
"set interface ip6 table <interface> <table-id>" 667 u32 gcount, scount, ss, gg, incr;
684 if (
unformat (line_input,
"table %d", &table_id))
686 else if (
unformat (line_input,
"del"))
688 else if (
unformat (line_input,
"add"))
690 else if (
unformat (line_input,
"rpf-id %d", &rpf_id))
692 else if (
unformat (line_input,
"scount %d", &scount))
694 else if (
unformat (line_input,
"gcount %d", &gcount))
696 else if (
unformat (line_input,
"%U %U",
704 else if (
unformat (line_input,
"%U %U",
712 else if (
unformat (line_input,
"%U/%d",
719 else if (
unformat (line_input,
"%U/%d",
726 else if (
unformat (line_input,
"%U",
733 else if (
unformat (line_input,
"%U",
740 else if (
unformat (line_input,
"via local Forward"))
754 else if (
unformat (line_input,
"via %U",
759 else if (
unformat (line_input,
"%U",
791 incr = 1 << (32 - (pfx.
fp_len % 32));
795 incr = 1 << (128 - (pfx.
fp_len % 128));
798 for (ss = 0; ss < scount; ss++)
800 for (gg = 0; gg < gcount; gg++)
802 if (is_del && 0 ==
vec_len (rpaths))
825 clib_host_to_net_u32 (incr +
826 clib_net_to_host_u32 (pfx.
832 int bucket = (incr < 64 ? 0 : 1);
834 clib_host_to_net_u64 (incr +
835 clib_net_to_host_u64 (pfx.
836 fp_grp_addr.ip6.as_u64
844 clib_host_to_net_u32 (1 +
851 clib_host_to_net_u64 (1 +
859 if (scount > 1 || gcount > 1)
861 (scount * gcount) / (timet[1] - timet[0]));
895 .short_help =
"ip mroute [add|del] <dst-ip-addr>/<width> [table <table-id>] [rpf-id <ID>] [via <next-hop-ip-addr> [<interface>],",
fib_protocol_t fp_proto
protocol type
void mfib_table_entry_delete(u32 fib_index, const mfib_prefix_t *prefix, mfib_source_t source)
Delete a FIB entry.
clib_error_t * vnet_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)
ip46_address_t frp_addr
The next-hop address.
void ip_table_create(fib_protocol_t fproto, u32 table_id, u8 is_api, const u8 *name)
ip46_address_t fp_src_addr
void receive_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, const ip46_address_t *nh_addr, dpo_id_t *dpo)
enum mfib_entry_flags_t_ mfib_entry_flags_t
static uword unformat_dpo(unformat_input_t *input, va_list *args)
A representation of a path as described by a route producer.
vnet_main_t * vnet_get_main(void)
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.
uword unformat_fib_route_path(unformat_input_t *input, va_list *args)
Unformat a fib_route_path_t from CLI input.
u32 frp_mitf_flags
MFIB interface flags.
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
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.
void dpo_copy(dpo_id_t *dst, const dpo_id_t *src)
atomic copy a data-plane object.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
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.
dpo_proto_t frp_proto
The protocol of the address below.
unformat_function_t unformat_vnet_sw_interface
static clib_error_t * vnet_ip_route_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
mhash_t address_to_if_address_index
Hash table mapping address to index in interface address pool.
format_function_t format_vnet_sw_if_index_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)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
int ip_table_bind(fib_protocol_t fproto, u32 sw_if_index, u32 table_id, u8 is_api)
const dpo_id_t * drop_dpo_get(dpo_proto_t proto)
static clib_error_t * ip6_table_bind_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u32 frp_sw_if_index
The interface.
description fragment has unexpected format
Aggregate type for a prefix.
const dpo_id_t * punt_dpo_get(dpo_proto_t proto)
#define clib_error_return(e, args...)
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
u32 fib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u16 fp_len
The mask length.
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
ip46_address_t fp_addr
The address type is not deriveable from the fp_addr member.
index_t classify_dpo_create(dpo_proto_t proto, u32 classify_table_index)
u8 local_next_by_ip_protocol[256]
Table mapping ip protocol to ip[46]-local node next index.
__clib_export void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
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)
clib_error_t * vnet_ip_mroute_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
uword unformat_mfib_entry_flags(unformat_input_t *input, va_list *args)
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.
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
void fib_table_entry_delete(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Delete a FIB entry.
void ip_table_delete(fib_protocol_t fproto, u32 table_id, u8 is_api)
#define clib_warning(format, args...)
void ip_lookup_init(ip_lookup_main_t *lm, u32 is_ip6)
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.
Aggregate type for a prefix.
u8 builtin_protocol_by_ip_protocol[256]
IP_BUILTIN_PROTOCOL_{TCP,UDP,ICMP,OTHER} by protocol in IP header.
#define VLIB_CLI_COMMAND(x,...)
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...
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
fib_route_path_flags_t frp_flags
flags on the path
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
static clib_error_t * ip4_table_bind_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
fib_protocol_t fp_proto
protocol type
clib_error_t * vnet_ip6_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
static clib_error_t * ip_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
#define foreach_flow_hash_bit
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
mhash_t prefix_to_if_prefix_index
Hash table mapping prefix to index in interface prefix pool.
u32 mfib_table_find(fib_protocol_t proto, u32 table_id)
Get the index of the FIB for a Table-ID.
u32 is_ip6
1 for ip6; 0 for ip4.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
ip4_main_t ip4_main
Global ip4 main structure.
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
void dpo_reset(dpo_id_t *dpo)
reset a DPO ID The DPO will be unlocked.
u8 * format_ip_flow_hash_config(u8 *s, va_list *args)
u8 * format_ip_adjacency_packet_data(u8 *s, va_list *args)
u16 fp_len
The mask length.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
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.
u8 frp_weight
[un]equal cost path weight
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(ip_sw_interface_add_del)
const ip46_address_t zero_addr
#include <vnet/feature/feature.h>
vl_api_interface_index_t sw_if_index
u32 fib_result_n_bytes
Number of bytes in a fib result.
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
format_function_t * format_address_and_length
Either format_ip4_address_and_length or format_ip6_address_and_length.