uword function_opaque;
} ip4_add_del_interface_address_callback_t;
+/**
+ * @brief IPv4 main type.
+ *
+ * State of IPv4 VPP processing including:
+ * - FIBs
+ * - Feature indices used in feature topological sort
+ * - Feature node run time references
+ */
+
typedef struct ip4_main_t {
ip_lookup_main_t lookup_main;
- /* Vector of FIBs. */
+ /** Vector of FIBs. */
ip4_fib_t * fibs;
u32 fib_masks[33];
- /* Table index indexed by software interface. */
+ /** Table index indexed by software interface. */
u32 * fib_index_by_sw_if_index;
- /* Hash table mapping table id to fib index.
+ /** Hash table mapping table id to fib index.
ID space is not necessarily dense; index space is dense. */
uword * fib_index_by_table_id;
- /* Vector of functions to call when routes are added/deleted. */
+ /** Vector of functions to call when routes are added/deleted. */
ip4_add_del_route_callback_t * add_del_route_callbacks;
- /* Hash table mapping interface route rewrite adjacency index by sw if index. */
+ /** Hash table mapping interface route rewrite adjacency index by sw if index. */
uword * interface_route_adj_index_by_sw_if_index;
- /* Functions to call when interface address changes. */
+ /** Functions to call when interface address changes. */
ip4_add_del_interface_address_callback_t * add_del_interface_address_callbacks;
- /* Template used to generate IP4 ARP packets. */
+ /** Template used to generate IP4 ARP packets. */
vlib_packet_template_t ip4_arp_request_packet_template;
- /* feature path configuration lists */
+ /** Feature path configuration lists */
vnet_ip_feature_registration_t * next_uc_feature;
vnet_ip_feature_registration_t * next_mc_feature;
- /* Built-in unicast feature path indices, see ip_feature_init_cast(...) */
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
u32 ip4_unicast_rx_feature_check_access;
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
u32 ip4_unicast_rx_feature_source_reachable_via_rx;
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
u32 ip4_unicast_rx_feature_source_reachable_via_any;
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
+ u32 ip4_unicast_rx_feature_policer_classify;
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
u32 ip4_unicast_rx_feature_ipsec;
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
u32 ip4_unicast_rx_feature_vpath;
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
u32 ip4_unicast_rx_feature_lookup;
+ /** Built-in unicast feature path indice, see @ref ip_feature_init_cast() */
+ u32 ip4_unicast_rx_feature_source_and_port_range_check;
- /* Built-in multicast feature path indices */
+ /** Built-in multicast feature path indices */
u32 ip4_multicast_rx_feature_vpath;
+ /** Built-in multicast feature path indices */
u32 ip4_multicast_rx_feature_lookup;
- /* Save results for show command */
+ /** Save results for show command */
char ** feature_nodes[VNET_N_CAST];
-
- /* Seed for Jenkins hash used to compute ip4 flow hash. */
+
+ /** Seed for Jenkins hash used to compute ip4 flow hash. */
u32 flow_hash_seed;
+ /** @brief Template information for VPP generated packets */
struct {
- /* TTL to use for host generated packets. */
+ /** TTL to use for host generated packets. */
u8 ttl;
- /* TOS byte to use for host generated packets. */
+ /** TOS byte to use for host generated packets. */
u8 tos;
u8 pad[2];
} host_config;
} ip4_main_t;
-/* Global ip4 main structure. */
+/** Global ip4 main structure. */
extern ip4_main_t ip4_main;
#define VNET_IP4_UNICAST_FEATURE_INIT(x,...) \
__VA_ARGS__ vnet_ip_feature_registration_t mc_##x
-/* Global ip4 input node. Errors get attached to ip4 input node. */
+/** Global ip4 input node. Errors get attached to ip4 input node. */
extern vlib_node_registration_t ip4_input_node;
extern vlib_node_registration_t ip4_lookup_node;
extern vlib_node_registration_t ip4_rewrite_node;
u32 next_hop_weight, u32 adj_index,
u32 explicit_fib_index);
+u32
+ip4_route_get_next_hop_adj (ip4_main_t * im,
+ u32 fib_index,
+ ip4_address_t *next_hop,
+ u32 next_hop_sw_if_index,
+ u32 explicit_fib_index);
+
void *
ip4_get_route (ip4_main_t * im,
u32 fib_index_or_table_id,
u32 sw_if_index,
u32 if_address_index);
+ip4_address_t *
+ip4_interface_first_address (ip4_main_t * im, u32 sw_if_index,
+ ip_interface_address_t ** result_ia);
+
/* Send an ARP request to see if given destination is reachable on given interface. */
clib_error_t *
ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index);