Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 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> |
Neale Ranns | e22a704 | 2022-08-09 03:03:29 +0000 | [diff] [blame] | 39 | #include <vnet/ip/ip.api_enum.h> |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 40 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 41 | #define IP_FRAG_FLAG_IP4_HEADER 0x01 //Encapsulating IPv4 header |
| 42 | #define IP_FRAG_FLAG_IP6_HEADER 0x02 //Encapsulating IPv6 header |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 43 | |
| 44 | #define IP4_FRAG_NODE_NAME "ip4-frag" |
| 45 | #define IP6_FRAG_NODE_NAME "ip6-frag" |
| 46 | |
Damjan Marion | b8abf87 | 2016-03-14 20:02:35 +0100 | [diff] [blame] | 47 | extern vlib_node_registration_t ip4_frag_node; |
| 48 | extern vlib_node_registration_t ip6_frag_node; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 49 | |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 50 | typedef enum |
| 51 | { |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 52 | IP_FRAG_NEXT_IP_REWRITE, |
| 53 | IP_FRAG_NEXT_IP_REWRITE_MIDCHAIN, |
| 54 | IP_FRAG_NEXT_IP4_LOOKUP, |
| 55 | IP_FRAG_NEXT_IP6_LOOKUP, |
| 56 | IP_FRAG_NEXT_ICMP_ERROR, |
| 57 | IP_FRAG_NEXT_DROP, |
| 58 | IP_FRAG_N_NEXT |
| 59 | } ip_frag_next_t; |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 60 | |
Neale Ranns | e22a704 | 2022-08-09 03:03:29 +0000 | [diff] [blame] | 61 | typedef vl_counter_ip_frag_enum_t ip_frag_error_t; |
BenoƮt Ganne | 4328995 | 2021-09-09 11:58:28 +0200 | [diff] [blame] | 62 | |
Ole Troan | 282093f | 2018-09-19 12:38:51 +0200 | [diff] [blame] | 63 | void ip_frag_set_vnet_buffer (vlib_buffer_t * b, u16 mtu, |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 64 | u8 next_index, u8 flags); |
Ole Troan | eb284a1 | 2019-10-09 13:33:19 +0200 | [diff] [blame] | 65 | |
| 66 | extern ip_frag_error_t ip4_frag_do_fragment (vlib_main_t * vm, |
| 67 | u32 from_bi, |
| 68 | u16 mtu, |
| 69 | u16 encapsize, u32 ** buffer); |
| 70 | extern ip_frag_error_t ip6_frag_do_fragment (vlib_main_t * vm, |
| 71 | u32 from_bi, |
| 72 | u16 mtu, |
| 73 | u16 encapsize, u32 ** buffer); |
| 74 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 75 | #endif /* ifndef IP_FRAG_H */ |
Dave Barach | d7cb1b5 | 2016-12-09 09:52:16 -0500 | [diff] [blame] | 76 | |
| 77 | /* |
| 78 | * fd.io coding-style-patch-verification: ON |
| 79 | * |
| 80 | * Local Variables: |
| 81 | * eval: (c-set-style "gnu") |
| 82 | * End: |
| 83 | */ |