67 u32 is_del,
u32 * result_if_address_index)
79 (address_length == 0) ||
80 (lm->
is_ip6 && address_length > 128) ||
81 (!lm->
is_ip6 && address_length > 32))
83 vnm->
api_errno = VNET_API_ERROR_ADDRESS_LENGTH_MISMATCH;
85 (
"%U wrong length (expected %d) for interface %U",
96 vnm->
api_errno = VNET_API_ERROR_ADDRESS_NOT_FOUND_FOR_INTERFACE;
99 addr_fib, address_length,
130 if (result_if_address_index)
131 *result_if_address_index = ~0;
146 while (pi != (
u32) ~ 0)
164 (hi != ~0) ? hi : ai;
165 if (result_if_address_index)
166 *result_if_address_index = ai;
172 if (result_if_address_index)
173 *result_if_address_index = ~0;
174 vnm->
api_errno = VNET_API_ERROR_DUPLICATE_IF_ADDRESS;
176 (
"Prefix %U already found on interface %U",
181 if (result_if_address_index)
192 lookup_main.if_address_pool_index_by_sw_if_index,
195 lookup_main.if_address_pool_index_by_sw_if_index,
216 sizeof (ip6_address_fib_t));
229 for (i = 0; i < 256; i++)
251 #define _(n,v) if (flow_hash_config & v) s = format (s, "%s ", #n); 261 u32 adj_index = va_arg (*args,
u32);
262 u8 *packet_data = va_arg (*args,
u8 *);
263 u32 n_packet_data_bytes = va_arg (*args,
u32);
267 return format (s,
"<invalid adjacency>");
301 else if (
unformat (input,
"null-send-unreach"))
303 else if (
unformat (input,
"null-send-prohibit"))
307 else if (
unformat (input,
"classify"))
311 if (!
unformat (input,
"%d", &classify_table_index))
357 if (
unformat (line_input,
"table %d", &table_id))
359 else if (
unformat (line_input,
"count %f", &count))
362 else if (
unformat (line_input,
"%U/%d",
368 else if (
unformat (line_input,
"%U/%d",
374 else if (
unformat (line_input,
"via %U",
379 else if (
vec_len (prefixs) > 0 &&
385 else if (
unformat (line_input,
"del"))
387 else if (
unformat (line_input,
"add"))
427 for (i = 0; i <
vec_len (prefixs); i++)
429 if (is_del && 0 == vec_len (rpaths))
433 else if (!is_del && 1 == vec_len (dpos))
442 else if (vec_len (dpos) > 0)
446 "Load-balancing over multiple special adjacencies is unsupported");
449 else if (0 < vec_len (rpaths))
459 for (k = 0; k < n; k++)
479 clib_host_to_net_u32 (incr +
480 clib_net_to_host_u32 (dst.
485 int bucket = (incr < 64 ? 0 : 1);
486 dst.ip6.as_u64[bucket] =
487 clib_host_to_net_u64 (incr +
488 clib_net_to_host_u64 (dst.ip6.as_u64
531 if (
unformat (line_input,
"%d", &table_id))
533 else if (
unformat (line_input,
"del"))
535 else if (
unformat (line_input,
"add"))
537 else if (
unformat (line_input,
"name %s", &name))
551 else if (0 == table_id)
590 .short_help =
"Internet protocol (IP) commands",
597 .short_help =
"Internet protocol version 6 (IPv6) commands",
604 .short_help =
"Internet protocol (IP) show commands",
611 .short_help =
"Internet protocol version 6 (IPv6) show commands",
645 .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>]",
660 .short_help =
"ip table [add|del] <table-id>",
675 .short_help =
"ip6 table [add|del] <table-id>",
699 if (
unformat (input,
"%d", &table_id))
710 if (VNET_API_ERROR_ADDRESS_FOUND_FOR_INTERFACE == rv)
717 else if (VNET_API_ERROR_NO_SUCH_FIB == rv)
768 .path =
"set interface ip table",
770 .short_help =
"set interface ip table <interface> <table-id>",
796 .path =
"set interface ip6 table",
798 .short_help =
"set interface ip6 table <interface> <table-id>" 813 u32 gcount, scount, ss, gg, incr;
830 if (
unformat (line_input,
"table %d", &table_id))
832 else if (
unformat (line_input,
"del"))
834 else if (
unformat (line_input,
"add"))
836 else if (
unformat (line_input,
"rpf-id %d", &rpf_id))
838 else if (
unformat (line_input,
"scount %d", &scount))
840 else if (
unformat (line_input,
"gcount %d", &gcount))
842 else if (
unformat (line_input,
"%U %U",
850 else if (
unformat (line_input,
"%U %U",
858 else if (
unformat (line_input,
"%U/%d",
865 else if (
unformat (line_input,
"%U/%d",
872 else if (
unformat (line_input,
"%U",
879 else if (
unformat (line_input,
"%U",
886 else if (
unformat (line_input,
"via local Forward"))
900 else if (
unformat (line_input,
"via %U",
905 else if (
unformat (line_input,
"%U",
937 incr = 1 << (32 - (pfx.
fp_len % 32));
941 incr = 1 << (128 - (pfx.
fp_len % 128));
944 for (ss = 0; ss < scount; ss++)
946 for (gg = 0; gg < gcount; gg++)
948 if (is_del && 0 ==
vec_len (rpaths))
971 clib_host_to_net_u32 (incr +
972 clib_net_to_host_u32 (pfx.
978 int bucket = (incr < 64 ? 0 : 1);
980 clib_host_to_net_u64 (incr +
981 clib_net_to_host_u64 (pfx.
982 fp_grp_addr.ip6.as_u64
990 clib_host_to_net_u32 (1 +
997 clib_host_to_net_u64 (1 +
1005 if (scount > 1 || gcount > 1)
1007 (scount * gcount) / (timet[1] - timet[0]));
1040 .path =
"ip mroute",
1041 .short_help =
"ip mroute [add|del] <dst-ip-addr>/<width> [table <table-id>] [rpf-id <ID>] [via <next-hop-ip-addr> [<interface>],",
1061 uword *event_data = 0;
1065 if (retry_count > 0)
1070 for (i = 0; i < retry_count; i++)
1113 uword *event_data = 0;
1117 if (retry_count > 0)
1122 for (i = 0; i < retry_count; i++)
1168 int retry_count = 3;
1170 int address_set = 0;
1181 else if (
unformat (line_input,
"retry %d", &retry_count))
1199 if (sw_if_index == ~0)
1204 if (address_set == 0)
1209 if (address_set > 1)
1244 .path =
"ip probe-neighbor",
1246 .short_help =
"ip probe-neighbor <interface> <ip4-addr> | <ip6-addr> [retry nn]",
1258 "invalid sw_if_index");
1266 args->sw_if_index, &proxy_dpo);
1292 if (fib_index == ~0)
1349 fib_table_walk(fib_table->ft_index,
1351 ip_container_proxy_fib_table_walk,
1356 fib_table_walk(fib_table->ft_index,
1358 ip_container_proxy_fib_table_walk,
1370 u32 is_del, addr_set = 0;
1391 else if (
unformat (line_input,
"%U",
1398 else if (
unformat (line_input,
"%U",
1401 else if (
unformat (line_input,
"del"))
1411 if (~0 == sw_if_index || !addr_set)
1430 .path =
"ip container",
1432 .short_help =
"ip container <address> <interface>",
1456 else if (
unformat (line_input,
"%U",
1462 else if (
unformat (line_input,
"%U",
1473 if (~0 == sw_if_index)
1481 vlib_cli_output (vm,
"ip container proxy is: %s", has_proxy ?
"on" :
"off");
1489 .path =
"show ip container",
1491 .short_help =
"show ip container <address> <interface>",
static clib_error_t * ip6_probe_neighbor_wait(vlib_main_t *vm, ip6_address_t *a, u32 sw_if_index, int retry_count)
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.
Continue on to the next entry.
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)
fib_node_index_t fib_table_lookup_exact_match(u32 fib_index, const fib_prefix_t *prefix)
Perfom an exact match in the non-forwarding table.
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
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.
ip_interface_address_t * if_address_pool
Pool of addresses that are assigned to interfaces.
vnet_main_t * vnet_get_main(void)
static clib_error_t * ip4_probe_neighbor_wait(vlib_main_t *vm, ip4_address_t *a, u32 sw_if_index, int retry_count)
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.
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static f64 vlib_time_now(vlib_main_t *vm)
ip_container_proxy_cb_t cb
const dpo_id_t * fib_entry_contribute_ip_forwarding(fib_node_index_t fib_entry_index)
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.
This packet is to be rewritten and forwarded to the next processing node.
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).
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
const fib_prefix_t * fib_entry_get_prefix(fib_node_index_t fib_entry_index)
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
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
The data-path object representing L3 proxy.
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.
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
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 ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
static clib_error_t * ip6_table_bind_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
u32 frp_sw_if_index
The interface.
vl_api_interface_index_t sw_if_index
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
void fib_table_entry_special_remove(u32 fib_index, const fib_prefix_t *prefix, fib_source_t source)
Remove a 'special' entry from the FIB.
clib_error_t * vnet_ip_container_proxy_add_del(vnet_ip_container_proxy_args_t *args)
struct _vnet_ip_container_proxy_args vnet_ip_container_proxy_args_t
Aggregate type for a prefix.
const dpo_id_t * punt_dpo_get(dpo_proto_t proto)
#define clib_error_return(e, args...)
#define clib_error_create(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.
clib_error_t * ip6_probe_neighbor(vlib_main_t *vm, ip6_address_t *dst, u32 sw_if_index, u8 refresh)
u32 l3p_sw_if_index
The Software interface index on which traffic is l3_proxyd.
vnet_api_error_t api_errno
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
int(* ip_container_proxy_cb_t)(const fib_prefix_t *pfx, u32 sw_if_index, void *ctx)
format_function_t format_vnet_sw_interface_name
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void vnet_register_ip6_neighbor_resolution_event(vnet_main_t *vnm, void *address_arg, uword node_index, uword type_opaque, uword data)
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)
dpo_type_t dpoi_type
the type
static const dpo_id_t * load_balance_get_bucket_i(const load_balance_t *lb, u32 bucket)
#define pool_put(P, E)
Free an object E in pool P.
u8 local_next_by_ip_protocol[256]
Table mapping ip protocol to ip[46]-local node next index.
clib_error_t * ip_container_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
clib_error_t * ip4_probe_neighbor(vlib_main_t *vm, ip4_address_t *dst, u32 sw_if_index, u8 refresh)
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)
int fib_entry_is_sourced(fib_node_index_t fib_entry_index, fib_source_t source)
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.
void mhash_init(mhash_t *h, uword n_value_bytes, uword n_key_bytes)
static vlib_process_t * vlib_get_current_process(vlib_main_t *vm)
enum fib_table_walk_rc_t_ fib_table_walk_rc_t
return code controlling how a table walk proceeds
#define vec_free(V)
Free vector's memory (no header).
struct ip_container_proxy_walk_ctx_t_ ip_container_proxy_walk_ctx_t
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...)
static fib_table_walk_rc_t ip_container_proxy_fib_table_walk(fib_node_index_t fei, void *arg)
u32 fib_node_index_t
A typedef of a node index.
void ip_lookup_init(ip_lookup_main_t *lm, u32 is_ip6)
void ip_container_proxy_walk(ip_container_proxy_cb_t cb, void *ctx)
void vnet_register_ip4_arp_resolution_event(vnet_main_t *vnm, void *address_arg, uword node_index, uword type_opaque, uword data)
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,...)
#define foreach_flow_hash_bit
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
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...
u32 fib_table_get_table_id_for_sw_if_index(fib_protocol_t proto, u32 sw_if_index)
Get the Table-ID of the FIB bound to the interface.
static uword * mhash_get(mhash_t *h, const void *key)
static load_balance_t * load_balance_get(index_t lbi)
fib_route_path_flags_t frp_flags
flags on the path
dpo_proto_t fib_proto_to_dpo(fib_protocol_t fib_proto)
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
static l3_proxy_dpo_t * l3_proxy_dpo_get(index_t index)
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
static uword vnet_sw_interface_is_api_valid(vnet_main_t *vnm, u32 sw_if_index)
clib_error_t * vnet_ip6_table_cmd(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
index_t dpoi_index
the index of objects of that type
static clib_error_t * ip_sw_interface_add_del(vnet_main_t *vnm, u32 sw_if_index, u32 is_add)
#define FIB_NODE_INDEX_INVALID
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip_lookup_next_t lookup_next_index
Next hop after ip4-lookup.
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.
A route the is being 'proxied' on behalf of another device.
u32 is_ip6
1 for ip6; 0 for ip4.
#define DPO_INVALID
An initialiser for DPOs declared on the stack.
clib_error_t * ip_interface_address_add_del(ip_lookup_main_t *lm, u32 sw_if_index, void *addr_fib, u32 address_length, u32 is_del, u32 *result_if_address_index)
clib_error_t * show_ip_container_cmd_fn(vlib_main_t *vm, unformat_input_t *main_input, vlib_cli_command_t *cmd)
static int adj_is_valid(adj_index_t adj_index)
static uword vlib_in_process_context(vlib_main_t *vm)
ip4_main_t ip4_main
Global ip4 main structure.
#define clib_error_return_code(e, code, flags, args...)
u8 ip_container_proxy_is_set(fib_prefix_t *pfx, u32 sw_if_index)
struct fib_table_t_ * fibs
Vector of FIBs.
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)
static clib_error_t * probe_neighbor_address(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
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
struct fib_table_t_ * fibs
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(ip_sw_interface_add_del)
void l3_proxy_dpo_add_or_lock(dpo_proto_t proto, u32 sw_if_index, dpo_id_t *dpo)
const ip46_address_t zero_addr
u32 fib_result_n_bytes
Number of bytes in a fib result.
vl_api_fib_path_nh_proto_t proto
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
A protocol Independent FIB table.
u32 next_this_sw_interface
format_function_t * format_address_and_length
Either format_ip4_address_and_length or format_ip6_address_and_length.
u32 prev_this_sw_interface