aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2022-02-15 09:02:27 +0000
committerNeale Ranns <neale@graphiant.com>2022-02-15 09:02:27 +0000
commitf7040f01a57618c899de8d1feb30bcc70b0a45b9 (patch)
treef23942c61b8a3b8cc496c054d0d2071a85b330c9 /src
parentcdaf0d8c884ae0f337ef94b0ceb7449c991a3e6c (diff)
tcp: Do not include the tcp_packet.h file in the ip4_packet.h
Type: refactor IP4 does not depend on TCP (it's the other way around). This upside down dependency leads to some nasty circular includes when trying to use ip46_address.h in interface.h Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I4a1bd21543b08b9c1cf1e5563da738414734a878
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dpdk/device/node.c1
-rw-r--r--src/plugins/mss_clamp/mss_clamp_node.c1
-rw-r--r--src/plugins/nat/pnat/pnat_api.c1
-rw-r--r--src/plugins/nat/pnat/pnat_node.h1
-rw-r--r--src/plugins/vmxnet3/input.c1
-rw-r--r--src/plugins/wireguard/wireguard.h1
-rw-r--r--src/vnet/devices/virtio/node.c1
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c1
-rw-r--r--src/vnet/devices/virtio/virtio.h1
-rw-r--r--src/vnet/flow/flow.h1
-rw-r--r--src/vnet/gso/hdr_offset_parser.h1
-rw-r--r--src/vnet/hash/hash_eth.c1
-rw-r--r--src/vnet/interface_output.h1
-rw-r--r--src/vnet/ip/ip4_inlines.h1
-rw-r--r--src/vnet/ip/ip4_packet.h42
-rw-r--r--src/vnet/ip/ip6_packet.h55
-rw-r--r--src/vnet/ip6-nd/rd_cp_api.c1
-rw-r--r--src/vnet/tcp/tcp_packet.h97
18 files changed, 112 insertions, 97 deletions
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index d83fa35b177..e0ba517d2ce 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -26,6 +26,7 @@
#include <vnet/devices/devices.h>
#include <vnet/interface/rx_queue_funcs.h>
#include <vnet/feature/feature.h>
+#include <vnet/tcp/tcp_packet.h>
#include <dpdk/device/dpdk_priv.h>
diff --git a/src/plugins/mss_clamp/mss_clamp_node.c b/src/plugins/mss_clamp/mss_clamp_node.c
index 4a40b2329e1..7c403b129b2 100644
--- a/src/plugins/mss_clamp/mss_clamp_node.c
+++ b/src/plugins/mss_clamp/mss_clamp_node.c
@@ -24,6 +24,7 @@
#include <vnet/feature/feature.h>
#include <vnet/ip/ip4.h>
#include <vnet/ip/ip6.h>
+#include <vnet/tcp/tcp_packet.h>
extern vlib_node_registration_t mssc_ip4_in_node, mssc_ip4_out_node;
extern vlib_node_registration_t mssc_ip6_in_node, mssc_ip6_out_node;
diff --git a/src/plugins/nat/pnat/pnat_api.c b/src/plugins/nat/pnat/pnat_api.c
index 442ee7c42c2..35a73955b33 100644
--- a/src/plugins/nat/pnat/pnat_api.c
+++ b/src/plugins/nat/pnat/pnat_api.c
@@ -13,6 +13,7 @@
* limitations under the License.
*/
#include "pnat.h"
+#include <vnet/vnet.h>
#include <pnat/pnat.api_enum.h>
#include <pnat/pnat.api_types.h>
#include <vlibmemory/api.h>
diff --git a/src/plugins/nat/pnat/pnat_node.h b/src/plugins/nat/pnat/pnat_node.h
index 595189c2efb..f1afb450934 100644
--- a/src/plugins/nat/pnat/pnat_node.h
+++ b/src/plugins/nat/pnat/pnat_node.h
@@ -20,6 +20,7 @@
#include <pnat/pnat.api_enum.h>
#include <vnet/feature/feature.h>
#include <vnet/udp/udp_packet.h>
+#include <vnet/tcp/tcp_packet.h>
#include <vnet/ip/format.h>
/* PNAT next-nodes */
diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c
index 25d39ddaf91..a58e2c157be 100644
--- a/src/plugins/vmxnet3/input.c
+++ b/src/plugins/vmxnet3/input.c
@@ -23,6 +23,7 @@
#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/udp/udp_packet.h>
+#include <vnet/tcp/tcp_packet.h>
#include <vnet/interface/rx_queue_funcs.h>
#include <vmxnet3/vmxnet3.h>
diff --git a/src/plugins/wireguard/wireguard.h b/src/plugins/wireguard/wireguard.h
index 965c34aca50..ba96864fc27 100644
--- a/src/plugins/wireguard/wireguard.h
+++ b/src/plugins/wireguard/wireguard.h
@@ -18,6 +18,7 @@
#include <wireguard/wireguard_index_table.h>
#include <wireguard/wireguard_messages.h>
#include <wireguard/wireguard_timer.h>
+#include <vnet/buffer.h>
#define WG_DEFAULT_DATA_SIZE 2048
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index bc9afd9cb18..2d2da189d5d 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -31,6 +31,7 @@
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/udp/udp_packet.h>
+#include <vnet/tcp/tcp_packet.h>
#include <vnet/devices/virtio/virtio.h>
#include <vnet/devices/virtio/virtio_inline.h>
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index bdb3d27245b..ffa2d374abf 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -37,6 +37,7 @@
#include <vnet/devices/devices.h>
#include <vnet/feature/feature.h>
#include <vnet/udp/udp_packet.h>
+#include <vnet/tcp/tcp_packet.h>
#include <vnet/interface/rx_queue_funcs.h>
#include <vnet/devices/virtio/vhost_user.h>
diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h
index 267d8f94bb1..3784a1bf2e9 100644
--- a/src/vnet/devices/virtio/virtio.h
+++ b/src/vnet/devices/virtio/virtio.h
@@ -22,6 +22,7 @@
#include <vnet/devices/virtio/vhost_std.h>
#include <vnet/devices/virtio/virtio_buffering.h>
#include <vnet/gso/gro.h>
+#include <vnet/interface.h>
#define foreach_virtio_if_flag \
_(0, ADMIN_UP, "admin-up") \
diff --git a/src/vnet/flow/flow.h b/src/vnet/flow/flow.h
index 76c1df8a22f..4945f4367c7 100644
--- a/src/vnet/flow/flow.h
+++ b/src/vnet/flow/flow.h
@@ -18,6 +18,7 @@
#include <vppinfra/clib.h>
#include <vppinfra/pcap.h>
+#include <vnet/vnet.h>
#include <vnet/l3_types.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
diff --git a/src/vnet/gso/hdr_offset_parser.h b/src/vnet/gso/hdr_offset_parser.h
index b9b885cc58c..999a27880af 100644
--- a/src/vnet/gso/hdr_offset_parser.h
+++ b/src/vnet/gso/hdr_offset_parser.h
@@ -21,6 +21,7 @@
#include <vnet/ip/ip6_packet.h>
#include <vnet/udp/udp_local.h>
#include <vnet/udp/udp_packet.h>
+#include <vnet/tcp/tcp_packet.h>
#include <vnet/vnet.h>
#include <vnet/vxlan/vxlan_packet.h>
diff --git a/src/vnet/hash/hash_eth.c b/src/vnet/hash/hash_eth.c
index 84a21b059be..1ac8b66a1bc 100644
--- a/src/vnet/hash/hash_eth.c
+++ b/src/vnet/hash/hash_eth.c
@@ -23,6 +23,7 @@
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/ip6_hop_by_hop_packet.h>
+#include <vnet/tcp/tcp_packet.h>
#include <vppinfra/lb_hash_hash.h>
#include <vnet/hash/hash.h>
diff --git a/src/vnet/interface_output.h b/src/vnet/interface_output.h
index 786b0ff8e21..b512d9a04a8 100644
--- a/src/vnet/interface_output.h
+++ b/src/vnet/interface_output.h
@@ -41,6 +41,7 @@
#define __INTERFACE_INLINES_H__
#include <vnet/vnet.h>
+#include <vnet/tcp/tcp_packet.h>
static_always_inline void
vnet_calc_ip4_checksums (vlib_main_t *vm, vlib_buffer_t *b, ip4_header_t *ip4,
diff --git a/src/vnet/ip/ip4_inlines.h b/src/vnet/ip/ip4_inlines.h
index 9a6c8c7f8fb..ca7327fbcdc 100644
--- a/src/vnet/ip/ip4_inlines.h
+++ b/src/vnet/ip/ip4_inlines.h
@@ -42,6 +42,7 @@
#include <vnet/ip/ip_flow_hash.h>
#include <vnet/ip/ip4_packet.h>
+#include <vnet/tcp/tcp_packet.h>
#define IP_DF 0x4000 /* don't fragment */
diff --git a/src/vnet/ip/ip4_packet.h b/src/vnet/ip/ip4_packet.h
index 513a7449b54..2673558e19e 100644
--- a/src/vnet/ip/ip4_packet.h
+++ b/src/vnet/ip/ip4_packet.h
@@ -41,7 +41,6 @@
#define included_ip4_packet_h
#include <vnet/ip/ip_packet.h> /* for ip_csum_t */
-#include <vnet/tcp/tcp_packet.h> /* for tcp_header_t */
#include <vppinfra/byte_order.h> /* for clib_net_to_host_u16 */
#include <vppinfra/warnings.h> /* for WARN_OFF/WARN_ON macro */
@@ -476,47 +475,6 @@ ip4_multicast_ethernet_address (u8 * ethernet_address,
ethernet_address[5] = d[3];
}
-always_inline void
-ip4_tcp_reply_x1 (ip4_header_t * ip0, tcp_header_t * tcp0)
-{
- u32 src0, dst0;
-
- src0 = ip0->src_address.data_u32;
- dst0 = ip0->dst_address.data_u32;
- ip0->src_address.data_u32 = dst0;
- ip0->dst_address.data_u32 = src0;
-
- src0 = tcp0->src;
- dst0 = tcp0->dst;
- tcp0->src = dst0;
- tcp0->dst = src0;
-}
-
-always_inline void
-ip4_tcp_reply_x2 (ip4_header_t * ip0, ip4_header_t * ip1,
- tcp_header_t * tcp0, tcp_header_t * tcp1)
-{
- u32 src0, dst0, src1, dst1;
-
- src0 = ip0->src_address.data_u32;
- src1 = ip1->src_address.data_u32;
- dst0 = ip0->dst_address.data_u32;
- dst1 = ip1->dst_address.data_u32;
- ip0->src_address.data_u32 = dst0;
- ip1->src_address.data_u32 = dst1;
- ip0->dst_address.data_u32 = src0;
- ip1->dst_address.data_u32 = src1;
-
- src0 = tcp0->src;
- src1 = tcp1->src;
- dst0 = tcp0->dst;
- dst1 = tcp1->dst;
- tcp0->src = dst0;
- tcp1->src = dst1;
- tcp0->dst = src0;
- tcp1->dst = src1;
-}
-
#endif /* included_ip4_packet_h */
/*
diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h
index fecec7cdf5b..b00eac72c04 100644
--- a/src/vnet/ip/ip6_packet.h
+++ b/src/vnet/ip/ip6_packet.h
@@ -40,7 +40,7 @@
#ifndef included_ip6_packet_h
#define included_ip6_packet_h
-#include <vnet/tcp/tcp_packet.h>
+#include <vlib/vlib.h>
#include <vnet/ip/ip4_packet.h>
#include <stdbool.h>
@@ -423,59 +423,6 @@ ip6_copy_header (ip6_header_t * dst, const ip6_header_t * src)
dst->dst_address.as_uword[1] = src->dst_address.as_uword[1];
}
-always_inline void
-ip6_tcp_reply_x1 (ip6_header_t * ip0, tcp_header_t * tcp0)
-{
- {
- ip6_address_t src0, dst0;
-
- src0 = ip0->src_address;
- dst0 = ip0->dst_address;
- ip0->src_address = dst0;
- ip0->dst_address = src0;
- }
-
- {
- u16 src0, dst0;
-
- src0 = tcp0->src;
- dst0 = tcp0->dst;
- tcp0->src = dst0;
- tcp0->dst = src0;
- }
-}
-
-always_inline void
-ip6_tcp_reply_x2 (ip6_header_t * ip0, ip6_header_t * ip1,
- tcp_header_t * tcp0, tcp_header_t * tcp1)
-{
- {
- ip6_address_t src0, dst0, src1, dst1;
-
- src0 = ip0->src_address;
- src1 = ip1->src_address;
- dst0 = ip0->dst_address;
- dst1 = ip1->dst_address;
- ip0->src_address = dst0;
- ip1->src_address = dst1;
- ip0->dst_address = src0;
- ip1->dst_address = src1;
- }
-
- {
- u16 src0, dst0, src1, dst1;
-
- src0 = tcp0->src;
- src1 = tcp1->src;
- dst0 = tcp0->dst;
- dst1 = tcp1->dst;
- tcp0->src = dst0;
- tcp1->src = dst1;
- tcp0->dst = src0;
- tcp1->dst = src1;
- }
-}
-
typedef CLIB_PACKED (struct {
u8 data;
}) ip6_pad1_option_t;
diff --git a/src/vnet/ip6-nd/rd_cp_api.c b/src/vnet/ip6-nd/rd_cp_api.c
index 1f0d8587970..3cd55a702e1 100644
--- a/src/vnet/ip6-nd/rd_cp_api.c
+++ b/src/vnet/ip6-nd/rd_cp_api.c
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+#include <vnet/vnet.h>
#include <vnet/ip6-nd/rd_cp.h>
#include <vlibapi/api.h>
diff --git a/src/vnet/tcp/tcp_packet.h b/src/vnet/tcp/tcp_packet.h
index b0636d871d5..c137ea68108 100644
--- a/src/vnet/tcp/tcp_packet.h
+++ b/src/vnet/tcp/tcp_packet.h
@@ -16,7 +16,8 @@
#ifndef included_tcp_packet_h
#define included_tcp_packet_h
-#include <vnet/vnet.h>
+#include <vnet/ip/ip4_packet.h>
+#include <vnet/ip/ip6_packet.h>
/* TCP flags bit 0 first. */
#define foreach_tcp_flag \
@@ -185,6 +186,100 @@ typedef struct
#define timestamp_lt(_t1, _t2) ((i32)((_t1)-(_t2)) < 0)
#define timestamp_leq(_t1, _t2) ((i32)((_t1)-(_t2)) <= 0)
+always_inline void
+ip4_tcp_reply_x1 (ip4_header_t *ip0, tcp_header_t *tcp0)
+{
+ u32 src0, dst0;
+
+ src0 = ip0->src_address.data_u32;
+ dst0 = ip0->dst_address.data_u32;
+ ip0->src_address.data_u32 = dst0;
+ ip0->dst_address.data_u32 = src0;
+
+ src0 = tcp0->src;
+ dst0 = tcp0->dst;
+ tcp0->src = dst0;
+ tcp0->dst = src0;
+}
+
+always_inline void
+ip4_tcp_reply_x2 (ip4_header_t *ip0, ip4_header_t *ip1, tcp_header_t *tcp0,
+ tcp_header_t *tcp1)
+{
+ u32 src0, dst0, src1, dst1;
+
+ src0 = ip0->src_address.data_u32;
+ src1 = ip1->src_address.data_u32;
+ dst0 = ip0->dst_address.data_u32;
+ dst1 = ip1->dst_address.data_u32;
+ ip0->src_address.data_u32 = dst0;
+ ip1->src_address.data_u32 = dst1;
+ ip0->dst_address.data_u32 = src0;
+ ip1->dst_address.data_u32 = src1;
+
+ src0 = tcp0->src;
+ src1 = tcp1->src;
+ dst0 = tcp0->dst;
+ dst1 = tcp1->dst;
+ tcp0->src = dst0;
+ tcp1->src = dst1;
+ tcp0->dst = src0;
+ tcp1->dst = src1;
+}
+
+always_inline void
+ip6_tcp_reply_x1 (ip6_header_t *ip0, tcp_header_t *tcp0)
+{
+ {
+ ip6_address_t src0, dst0;
+
+ src0 = ip0->src_address;
+ dst0 = ip0->dst_address;
+ ip0->src_address = dst0;
+ ip0->dst_address = src0;
+ }
+
+ {
+ u16 src0, dst0;
+
+ src0 = tcp0->src;
+ dst0 = tcp0->dst;
+ tcp0->src = dst0;
+ tcp0->dst = src0;
+ }
+}
+
+always_inline void
+ip6_tcp_reply_x2 (ip6_header_t *ip0, ip6_header_t *ip1, tcp_header_t *tcp0,
+ tcp_header_t *tcp1)
+{
+ {
+ ip6_address_t src0, dst0, src1, dst1;
+
+ src0 = ip0->src_address;
+ src1 = ip1->src_address;
+ dst0 = ip0->dst_address;
+ dst1 = ip1->dst_address;
+ ip0->src_address = dst0;
+ ip1->src_address = dst1;
+ ip0->dst_address = src0;
+ ip1->dst_address = src1;
+ }
+
+ {
+ u16 src0, dst0, src1, dst1;
+
+ src0 = tcp0->src;
+ src1 = tcp1->src;
+ dst0 = tcp0->dst;
+ dst1 = tcp1->dst;
+ tcp0->src = dst0;
+ tcp1->src = dst1;
+ tcp0->dst = src0;
+ tcp1->dst = src1;
+ }
+}
+
/**
* Parse TCP header options.
*