FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
ip_frag.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------
2  * Copyright (c) 2009-2014 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *---------------------------------------------------------------------------
15  */
16 /*
17  * IPv4 and IPv6 Fragmentation Nodes
18  *
19  * A packet sent to those nodes require the following
20  * buffer attributes to be set:
21  * ip_frag.header_offset :
22  * Where to find the IPv4 (or IPv6) header in the packet. Previous
23  * bytes are left untouched and copied in every fragment. The fragments
24  * are then appended. This option is used for fragmented packets
25  * that are encapsulated.
26  * ip_frag.mtu :
27  * Maximum size of IP packets, header included, but ignoring
28  * the 'ip_frag.header_offset' copied bytes.
29  * ip_frag.next_index :
30  * One of ip_frag_next_t, indicating to which exit node the fragments
31  * should be sent to.
32  *
33  */
34 
35 #ifndef IP_FRAG_H
36 #define IP_FRAG_H
37 
38 #include <vnet/vnet.h>
39 
40 #define IP_FRAG_FLAG_IP4_HEADER 0x01 //Encapsulating IPv4 header
41 #define IP_FRAG_FLAG_IP6_HEADER 0x02 //Encapsulating IPv6 header
42 
43 #define IP4_FRAG_NODE_NAME "ip4-frag"
44 #define IP6_FRAG_NODE_NAME "ip6-frag"
45 
48 
49 typedef enum
50 {
59 
60 #define foreach_ip_frag_error \
61  /* Must be first. */ \
62  _(NONE, "packet fragmented") \
63  _(SMALL_PACKET, "packet smaller than MTU") \
64  _(FRAGMENT_SENT, "number of sent fragments") \
65  _(CANT_FRAGMENT_HEADER, "can't fragment header") \
66  _(DONT_FRAGMENT_SET, "can't fragment this packet") \
67  _(MALFORMED, "malformed packet") \
68  _(MEMORY, "could not allocate buffer") \
69  _(UNKNOWN, "unknown error")
70 
71 typedef enum
72 {
73 #define _(sym,str) IP_FRAG_ERROR_##sym,
75 #undef _
78 
81 
83  u32 from_bi,
84  u16 mtu,
85  u16 encapsize, u32 ** buffer);
87  u32 from_bi,
88  u16 mtu,
89  u16 encapsize, u32 ** buffer);
90 
91 #endif /* ifndef IP_FRAG_H */
92 
93 /*
94  * fd.io coding-style-patch-verification: ON
95  *
96  * Local Variables:
97  * eval: (c-set-style "gnu")
98  * End:
99  */
ip_frag_error_t
ip_frag_error_t
Definition: ip_frag.h:71
buffer
char * buffer
Definition: cJSON.h:163
next_index
nat44_ei_hairpin_src_next_t next_index
Definition: nat44_ei_hairpinning.c:412
u16
unsigned short u16
Definition: types.h:57
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
IP_FRAG_NEXT_DROP
@ IP_FRAG_NEXT_DROP
Definition: ip_frag.h:56
ip_frag_next_t
ip_frag_next_t
Definition: ip_frag.h:49
ip4_frag_node
vlib_node_registration_t ip4_frag_node
(constructor) VLIB_REGISTER_NODE (ip4_frag_node)
Definition: ip_frag.c:512
ip6_frag_node
vlib_node_registration_t ip6_frag_node
(constructor) VLIB_REGISTER_NODE (ip6_frag_node)
Definition: ip_frag.c:535
ip6_frag_do_fragment
ip_frag_error_t ip6_frag_do_fragment(vlib_main_t *vm, u32 from_bi, u16 mtu, u16 encapsize, u32 **buffer)
Definition: ip_frag.c:381
IP_FRAG_NEXT_IP_REWRITE
@ IP_FRAG_NEXT_IP_REWRITE
Definition: ip_frag.h:51
ip_frag_set_vnet_buffer
void ip_frag_set_vnet_buffer(vlib_buffer_t *b, u16 mtu, u8 next_index, u8 flags)
Definition: ip_frag.c:238
vlib_node_registration_t
struct _vlib_node_registration vlib_node_registration_t
foreach_ip_frag_error
#define foreach_ip_frag_error
Definition: ip_frag.h:60
IP_FRAG_N_ERROR
@ IP_FRAG_N_ERROR
Definition: ip_frag.h:76
IP_FRAG_NEXT_IP6_LOOKUP
@ IP_FRAG_NEXT_IP6_LOOKUP
Definition: ip_frag.h:54
u32
unsigned int u32
Definition: types.h:88
ip4_frag_do_fragment
ip_frag_error_t ip4_frag_do_fragment(vlib_main_t *vm, u32 from_bi, u16 mtu, u16 encapsize, u32 **buffer)
Definition: ip_frag.c:93
IP_FRAG_N_NEXT
@ IP_FRAG_N_NEXT
Definition: ip_frag.h:57
vlib_main_t
Definition: main.h:102
b
vlib_buffer_t ** b
Definition: nat44_ei_out2in.c:717
u8
unsigned char u8
Definition: types.h:56
IP_FRAG_NEXT_ICMP_ERROR
@ IP_FRAG_NEXT_ICMP_ERROR
Definition: ip_frag.h:55
vnet.h
IP_FRAG_NEXT_IP4_LOOKUP
@ IP_FRAG_NEXT_IP4_LOOKUP
Definition: ip_frag.h:53
IP_FRAG_NEXT_IP_REWRITE_MIDCHAIN
@ IP_FRAG_NEXT_IP_REWRITE_MIDCHAIN
Definition: ip_frag.h:52
vlib_buffer_t
VLIB buffer representation.
Definition: buffer.h:111
flags
vl_api_wireguard_peer_flags_t flags
Definition: wireguard.api:105