40 #ifndef included_ip_ip4_h 41 #define included_ip_ip4_h 177 #define VNET_IP4_UNICAST_FEATURE_INIT(x,...) \ 178 __VA_ARGS__ vnet_feature_registration_t uc_##x; \ 179 static void __vnet_add_feature_registration_uc_##x (void) \ 180 __attribute__((__constructor__)) ; \ 181 static void __vnet_add_feature_registration_uc_##x (void) \ 183 ip4_main_t * im = &ip4_main; \ 184 uc_##x.next = im->next_feature[VNET_IP_RX_UNICAST_FEAT]; \ 185 im->next_feature[VNET_IP_RX_UNICAST_FEAT] = &uc_##x; \ 187 __VA_ARGS__ vnet_feature_registration_t uc_##x 189 #define VNET_IP4_MULTICAST_FEATURE_INIT(x,...) \ 190 __VA_ARGS__ vnet_feature_registration_t mc_##x; \ 191 static void __vnet_add_feature_registration_mc_##x (void) \ 192 __attribute__((__constructor__)) ; \ 193 static void __vnet_add_feature_registration_mc_##x (void) \ 195 ip4_main_t * im = &ip4_main; \ 196 mc_##x.next = im->next_feature[VNET_IP_RX_MULTICAST_FEAT]; \ 197 im->next_feature[VNET_IP_RX_MULTICAST_FEAT] = &mc_##x; \ 199 __VA_ARGS__ vnet_feature_registration_t mc_##x 201 #define VNET_IP4_TX_FEATURE_INIT(x,...) \ 202 __VA_ARGS__ vnet_feature_registration_t tx_##x; \ 203 static void __vnet_add_feature_registration_tx_##x (void) \ 204 __attribute__((__constructor__)) ; \ 205 static void __vnet_add_feature_registration_tx_##x (void) \ 207 ip4_main_t * im = &ip4_main; \ 208 tx_##x.next = im->next_feature[VNET_IP_TX_FEAT]; \ 209 im->next_feature[VNET_IP_TX_FEAT] = &tx_##x; \ 211 __VA_ARGS__ vnet_feature_registration_t tx_##x 290 *result_ia = result ? ia : 0;
319 u32 next_node_index);
347 || ip->
protocol == IP_PROTOCOL_UDP);
358 t1 = is_tcp_udp ? tcp->
ports.src : 0;
359 t2 = is_tcp_udp ? tcp->
ports.dst : 0;
365 (t1<<16) | t2 : (t2<<16) | t1;
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
u32 ip4_unicast_rx_feature_drop
Built-in unicast feature path indice, see vnet_feature_arc_init()
u8 pad[3]
log2 (size of the packing page block)
u32 ip4_multicast_rx_feature_vpath
Built-in multicast feature path index.
int vnet_set_ip4_flow_hash(u32 table_id, flow_hash_config_t flow_hash_config)
ip4_add_del_interface_address_callback_t * add_del_interface_address_callbacks
Functions to call when interface address changes.
u32 ip4_unicast_tx_feature_source_and_port_range_check
Built-in unicast feature path index, see vnet_feature_arc_init()
u32 ip4_unicast_rx_feature_source_reachable_via_any
Built-in unicast feature path index, see vnet_feature_arc_init()
#define IP_FLOW_HASH_SRC_PORT
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
ip_interface_address_t * if_address_pool
Pool of addresses that are assigned to interfaces.
serialize_function_t serialize_vnet_ip4_main
Definitions for all things IP (v4|v6) unicast and multicast lookup related.
static u32 ip4_compute_flow_hash(const ip4_header_t *ip, flow_hash_config_t flow_hash_config)
ip4_address_t * ip4_interface_first_address(ip4_main_t *im, u32 sw_if_index, ip_interface_address_t **result_ia)
u32 ip4_multicast_rx_feature_drop
Built-in multicast feature path indices.
#define IP_FLOW_HASH_REVERSE_SRC_DST
vlib_node_registration_t ip4_midchain_node
(constructor) VLIB_REGISTER_NODE (ip4_midchain_node)
void( ip4_add_del_interface_address_function_t)(struct ip4_main_t *im, uword opaque, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 if_address_index, u32 is_del)
struct _vlib_node_registration vlib_node_registration_t
#define IP_FLOW_HASH_DST_PORT
ip_lookup_main_t lookup_main
static uword ip4_destination_matches_route(const ip4_main_t *im, const ip4_address_t *key, const ip4_address_t *dest, uword dest_length)
u32 * fib_index_by_sw_if_index
Table index indexed by software interface.
static uword ip4_unaligned_destination_matches_route(ip4_main_t *im, ip4_address_t *key, ip4_address_t *dest, uword dest_length)
void ip4_register_protocol(u32 protocol, u32 node_index)
uword ip4_udp_register_listener(vlib_main_t *vm, u16 dst_port, u32 next_node_index)
struct ip4_fib_t ip4_fib_t
u32 ip4_unicast_rx_feature_flow_classify
Built-in unicast feature path index, see vnet_feature_arc_init()
#define hash_v3_mix32(a, b, c)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
u32 fwd_classify_table_index
u32 ip4_unicast_rx_feature_policer_classify
Built-in unicast feature path index, see vnet_feature_arc_init()
u32 ip4_unicast_rx_feature_ipsec
Built-in unicast feature path indix, see vnet_feature_arc_init()
#define IP_FLOW_HASH_DST_ADDR
u32 rev_classify_table_index
int vnet_set_ip4_classify_intfc(vlib_main_t *vm, u32 sw_if_index, u32 table_index)
u32 ip4_unicast_rx_feature_check_access
Built-in unicast feature path index, see vnet_feature_arc_init()
void ip4_icmp_register_type(vlib_main_t *vm, icmp4_type_t type, u32 node_index)
vlib_node_registration_t ip4_arp_node
(constructor) VLIB_REGISTER_NODE (ip4_arp_node)
clib_error_t * ip4_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 is_del)
clib_error_t * ip4_probe_neighbor(vlib_main_t *vm, ip4_address_t *dst, u32 sw_if_index)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
uword * fib_entry_by_dst_address[33]
void ip4_sw_interface_enable_disable(u32 sw_if_index, u32 is_enable)
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
vlib_node_registration_t ip4_input_node
Global ip4 input node.
u8 * ip_enabled_by_sw_if_index
u32 ip4_multicast_rx_feature_lookup
Built-in multicast feature path index.
vlib_node_registration_t ip4_rewrite_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_node)
void ip4_mtrie_init(ip4_fib_mtrie_t *m)
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
clib_error_t * ip4_set_arp_limit(u32 arp_limit)
serialize_function_t unserialize_vnet_ip4_main
u32 ip4_unicast_rx_feature_source_reachable_via_rx
Built-in unicast feature path index, see vnet_feature_arc_init()
u32 ip4_unicast_rx_feature_lookup
Built-in unicast feature path index, see vnet_feature_arc_init()
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
vlib_packet_template_t ip4_arp_request_packet_template
Template used to generate IP4 ARP packets.
u32 ip4_tx_feature_interface_output
Built-in tx feature path index.
#define IP_FLOW_HASH_SRC_ADDR
Flow hash configuration.
u16 ip4_tcp_udp_compute_checksum(vlib_main_t *vm, vlib_buffer_t *p0, ip4_header_t *ip0)
#define hash_v3_finalize32(a, b, c)
u32 flow_hash_config_t
A flow hash configuration is a mask of the flow hash options.
struct ip4_main_t ip4_main_t
IPv4 main type.
void( serialize_function_t)(serialize_main_t *m, va_list *va)
vlib_node_registration_t ip4_rewrite_local_node
(constructor) VLIB_REGISTER_NODE (ip4_rewrite_local_node)
flow_hash_config_t flow_hash_config
#define clib_mem_unaligned(pointer, type)
vlib_node_registration_t ip4_glean_node
(constructor) VLIB_REGISTER_NODE (ip4_glean_node)
static uword ip4_destination_matches_interface(ip4_main_t *im, ip4_address_t *key, ip_interface_address_t *ia)
ip4_main_t ip4_main
Global ip4 main structure.
u32 ip4_unicast_rx_feature_vpath
Built-in unicast feature path index, see vnet_feature_arc_init()
u32 ip4_unicast_rx_feature_source_and_port_range_check
Built-in unicast feature path index, see vnet_feature_arc_init()
struct fib_table_t_ * fibs
Vector of FIBs.
#define IP_FLOW_HASH_PROTO
u32 flow_hash_seed
Seed for Jenkins hash used to compute ip4 flow hash.
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
static int ip4_src_address_for_packet(ip_lookup_main_t *lm, u32 sw_if_index, ip4_address_t *src)
u8 ttl
TTL to use for host generated packets.
u8 tos
TOS byte to use for host generated packets.
A protocol Independent FIB table.
struct _vnet_feature_registration vnet_feature_registration_t
feature registration object
static ip4_address_t * ip4_interface_address_matching_destination(ip4_main_t *im, ip4_address_t *dst, u32 sw_if_index, ip_interface_address_t **result_ia)