From eb284a1f8f10d752285a0a59e75bc54acae50779 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Wed, 9 Oct 2019 13:33:19 +0200 Subject: ip: functional interface to ip fragmentation This provides a functional interface to IP fragmentation. Allowing external features to fragment. Supports arbitrary encap size, for e.g. MPLS or inner fragmentation of tunnels. This also removed dual loop in MAP that was fundamentally broken. Type: fix Signed-off-by: Ole Troan Change-Id: Ia89ecec8ee3cbe2416edbe87630fdb714898c2a8 Signed-off-by: Ole Troan --- src/vnet/ip/ip_frag.h | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) (limited to 'src/vnet/ip/ip_frag.h') diff --git a/src/vnet/ip/ip_frag.h b/src/vnet/ip/ip_frag.h index ce4236b8465..86462e6c7d2 100644 --- a/src/vnet/ip/ip_frag.h +++ b/src/vnet/ip/ip_frag.h @@ -39,7 +39,6 @@ #define IP_FRAG_FLAG_IP4_HEADER 0x01 //Encapsulating IPv4 header #define IP_FRAG_FLAG_IP6_HEADER 0x02 //Encapsulating IPv6 header -#define IP_FRAG_FLAG_MPLS_HEADER 0x04 //Encapsulating MPLS header #define IP4_FRAG_NODE_NAME "ip4-frag" #define IP6_FRAG_NODE_NAME "ip6-frag" @@ -49,26 +48,14 @@ extern vlib_node_registration_t ip6_frag_node; typedef enum { - IP4_FRAG_NEXT_IP4_REWRITE, - IP4_FRAG_NEXT_IP4_REWRITE_MIDCHAIN, - IP4_FRAG_NEXT_IP4_LOOKUP, - IP4_FRAG_NEXT_IP6_LOOKUP, - IP4_FRAG_NEXT_MPLS_OUTPUT, - IP4_FRAG_NEXT_ICMP_ERROR, - IP4_FRAG_NEXT_DROP, - IP4_FRAG_N_NEXT -} ip4_frag_next_t; - -typedef enum -{ - IP6_FRAG_NEXT_IP4_LOOKUP, - IP6_FRAG_NEXT_IP6_LOOKUP, - IP6_FRAG_NEXT_IP6_REWRITE, - IP6_FRAG_NEXT_IP6_REWRITE_MIDCHAIN, - IP6_FRAG_NEXT_MPLS_OUTPUT, - IP6_FRAG_NEXT_DROP, - IP6_FRAG_N_NEXT -} ip6_frag_next_t; + IP_FRAG_NEXT_IP_REWRITE, + IP_FRAG_NEXT_IP_REWRITE_MIDCHAIN, + IP_FRAG_NEXT_IP4_LOOKUP, + IP_FRAG_NEXT_IP6_LOOKUP, + IP_FRAG_NEXT_ICMP_ERROR, + IP_FRAG_NEXT_DROP, + IP_FRAG_N_NEXT +} ip_frag_next_t; #define foreach_ip_frag_error \ /* Must be first. */ \ @@ -91,12 +78,16 @@ typedef enum void ip_frag_set_vnet_buffer (vlib_buffer_t * b, u16 mtu, u8 next_index, u8 flags); -void -ip4_frag_do_fragment (vlib_main_t * vm, u32 pi, u32 ** buffer, - ip_frag_error_t * error); -void -ip6_frag_do_fragment (vlib_main_t * vm, u32 pi, u32 ** buffer, - ip_frag_error_t * error); + +extern ip_frag_error_t ip4_frag_do_fragment (vlib_main_t * vm, + u32 from_bi, + u16 mtu, + u16 encapsize, u32 ** buffer); +extern ip_frag_error_t ip6_frag_do_fragment (vlib_main_t * vm, + u32 from_bi, + u16 mtu, + u16 encapsize, u32 ** buffer); + #endif /* ifndef IP_FRAG_H */ /* -- cgit 1.2.3-korg