X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fip%2Fip.h;h=1789fa1a6595cb0bc2a0ad158014a57e5b8c527d;hb=f2984bbb0;hp=65ccaef40c2b809c5b0404e096e1a68653db7e03;hpb=02833ff3294f4abbd8e3d52b38446e0f8f533ffc;p=vpp.git diff --git a/src/vnet/ip/ip.h b/src/vnet/ip/ip.h index 65ccaef40c2..1789fa1a659 100644 --- a/src/vnet/ip/ip.h +++ b/src/vnet/ip/ip.h @@ -46,9 +46,11 @@ #include +#include #include #include #include +#include #include #include @@ -63,23 +65,6 @@ #include #include #include -#include - -typedef enum ip_address_family_t_ -{ - AF_IP4, - AF_IP6, -} ip_address_family_t; - -extern uword unformat_ip_address_family (unformat_input_t * input, - va_list * args); -extern u8 *format_ip_address_family (u8 * s, va_list * args); - -#define FOR_EACH_IP_ADDRESS_FAMILY(_af) \ - for (_af = AF_IP4; _af <= AF_IP6; _af++) - -#define u8_ptr_add(ptr, index) (((u8 *)ptr) + index) -#define u16_net_add(u, val) clib_host_to_net_u16(clib_net_to_host_u16(u) + (val)) /* Per protocol info. */ typedef struct @@ -228,7 +213,6 @@ ip_calculate_l4_checksum (vlib_main_t * vm, vlib_buffer_t * p0, n_this_buffer = n_ip_bytes_this_buffer - ip_header_size; if (PREDICT_FALSE (n_this_buffer >> 31)) { /* error - ip header don't fit this buffer */ - ASSERT (0); return 0xfefe; } } @@ -250,7 +234,6 @@ ip_calculate_l4_checksum (vlib_main_t * vm, vlib_buffer_t * p0, if (!(p0->flags & VLIB_BUFFER_NEXT_PRESENT)) { - ASSERT (0); /* error - more buffer expected */ return 0xfefe; } @@ -292,20 +275,27 @@ u8 ip_is_local_host (ip46_address_t * ip46_address, u8 is_ip4); u8 ip4_is_local_host (ip4_address_t * ip4_address); u8 ip6_is_local_host (ip6_address_t * ip6_address); u8 ip_is_local (u32 fib_index, ip46_address_t * ip46_address, u8 is_ip4); -u8 ip_interface_has_address (u32 sw_if_index, ip46_address_t * ip, u8 is_ip4); void ip_copy (ip46_address_t * dst, ip46_address_t * src, u8 is_ip4); void ip_set (ip46_address_t * dst, void *src, u8 is_ip4); -void *ip_interface_get_first_ip (u32 sw_if_index, u8 is_ip4); -void ip4_address_normalize (ip4_address_t * ip4, u8 preflen); -void ip6_address_normalize (ip6_address_t * ip6, u8 preflen); -void ip4_preflen_to_mask (u8 pref_len, ip4_address_t * ip); -u32 ip4_mask_to_preflen (ip4_address_t * mask); -void ip4_prefix_max_address_host_order (ip4_address_t * ip, u8 plen, - ip4_address_t * res); -void ip6_prefix_max_address_host_order (ip6_address_t * ip, u8 plen, - ip6_address_t * res); -void ip6_preflen_to_mask (u8 pref_len, ip6_address_t * mask); -u32 ip6_mask_to_preflen (ip6_address_t * mask); + +int ip_flow_hash_set (ip_address_family_t af, u32 table_id, + flow_hash_config_t flow_hash_config); +void ip_feature_enable_disable (ip_address_family_t af, + ip_sub_address_family_t safi, + ip_feature_location_t loc, + const char *feature, + u32 sw_if_index, int enable_disable, + void *feature_config, + u32 n_feature_config_bytes); + +always_inline u32 vlib_buffer_get_ip4_fib_index (vlib_buffer_t * b); +always_inline u32 vlib_buffer_get_ip6_fib_index (vlib_buffer_t * b); +always_inline u32 +vlib_buffer_get_ip_fib_index (vlib_buffer_t * b, u8 is_ip4) +{ + return (is_ip4 ? vlib_buffer_get_ip4_fib_index + : vlib_buffer_get_ip6_fib_index) (b); +} #endif /* included_ip_main_h */