From b93c2c1713edf28815bb4057d04ff2dfb892c307 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 25 Jan 2022 19:03:44 +0100 Subject: passt: Drop include, carry own ipv6hdr and opt_hdr definitions This is the only remaining Linux-specific include -- drop it to avoid clang-tidy warnings and to make code more portable. Signed-off-by: Stefano Brivio --- arp.c | 2 -- conf.c | 2 -- dhcp.c | 2 -- dhcpv6.c | 2 -- icmp.c | 1 - ndp.c | 1 - netlink.c | 1 - passt.c | 1 - pasta.c | 2 -- pcap.c | 2 -- qrap.c | 2 -- tap.c | 1 - tcp.c | 1 - udp.c | 2 -- util.c | 2 -- util.h | 28 ++++++++++++++++++++++++++++ 16 files changed, 28 insertions(+), 24 deletions(-) diff --git a/arp.c b/arp.c index 2f3e3ac..b5af49f 100644 --- a/arp.c +++ b/arp.c @@ -23,8 +23,6 @@ #include #include -#include - #include "util.h" #include "arp.h" #include "dhcp.h" diff --git a/conf.c b/conf.c index 8ec67fc..ab91b7f 100644 --- a/conf.c +++ b/conf.c @@ -31,8 +31,6 @@ #include #include -#include - #include "util.h" #include "passt.h" #include "netlink.h" diff --git a/dhcp.c b/dhcp.c index 5169f56..0d6d698 100644 --- a/dhcp.c +++ b/dhcp.c @@ -23,8 +23,6 @@ #include #include -#include - #include "util.h" #include "checksum.h" #include "passt.h" diff --git a/dhcpv6.c b/dhcpv6.c index 5fe7cd0..e4113bc 100644 --- a/dhcpv6.c +++ b/dhcpv6.c @@ -25,8 +25,6 @@ #include #include -#include - #include "util.h" #include "passt.h" #include "tap.h" diff --git a/icmp.c b/icmp.c index cc76da7..67859e0 100644 --- a/icmp.c +++ b/icmp.c @@ -30,7 +30,6 @@ #include #include -#include #include "util.h" #include "passt.h" diff --git a/ndp.c b/ndp.c index ec6b5ef..386098c 100644 --- a/ndp.c +++ b/ndp.c @@ -24,7 +24,6 @@ #include #include -#include #include #include "checksum.h" diff --git a/netlink.c b/netlink.c index cea32fd..0948f45 100644 --- a/netlink.c +++ b/netlink.c @@ -25,7 +25,6 @@ #include #include -#include #include #include diff --git a/passt.c b/passt.c index 6436a45..3581428 100644 --- a/passt.c +++ b/passt.c @@ -54,7 +54,6 @@ #include #include #include -#include #include #include "seccomp.h" diff --git a/pasta.c b/pasta.c index 5150a3e..a2b842b 100644 --- a/pasta.c +++ b/pasta.c @@ -35,8 +35,6 @@ #include #include -#include - #include "util.h" #include "passt.h" #include "netlink.h" diff --git a/pcap.c b/pcap.c index 0c61cd8..e00fc45 100644 --- a/pcap.c +++ b/pcap.c @@ -28,8 +28,6 @@ #include #include -#include - #include "util.h" #include "passt.h" diff --git a/qrap.c b/qrap.c index 5a0a7fd..1eb82fa 100644 --- a/qrap.c +++ b/qrap.c @@ -26,8 +26,6 @@ #include #include -#include - #include "util.h" #include "passt.h" #include "arp.h" diff --git a/tap.c b/tap.c index a3fc249..d2f234d 100644 --- a/tap.c +++ b/tap.c @@ -40,7 +40,6 @@ #include #include -#include #include #include "checksum.h" diff --git a/tcp.c b/tcp.c index 2a842bd..96d462f 100644 --- a/tcp.c +++ b/tcp.c @@ -328,7 +328,6 @@ #include #include -#include #include /* For struct tcp_info */ #include "checksum.h" diff --git a/udp.c b/udp.c index 3b8a70a..15e0c96 100644 --- a/udp.c +++ b/udp.c @@ -110,8 +110,6 @@ #include #include -#include - #include "checksum.h" #include "util.h" #include "passt.h" diff --git a/util.c b/util.c index 3c4ba33..d172ad8 100644 --- a/util.c +++ b/util.c @@ -32,8 +32,6 @@ #include #include -#include - #include "util.h" #include "passt.h" diff --git a/util.h b/util.h index 0d50868..44c85db 100644 --- a/util.h +++ b/util.h @@ -149,6 +149,34 @@ enum bind_type { struct ctx; +struct ipv6hdr { +#pragma GCC diagnostic ignored "-Wpedantic" +#if __BYTE_ORDER == __BIG_ENDIAN + __u8 version:4, + priority:4; +#else + uint8_t priority:4, + version:4; +#endif +#pragma GCC diagnostic pop + uint8_t flow_lbl[3]; + + __be16 payload_len; + __u8 nexthdr; + __u8 hop_limit; + + struct in6_addr saddr; + struct in6_addr daddr; +}; + +struct ipv6_opt_hdr { + __u8 nexthdr; + __u8 hdrlen; + /* + * TLV encoded option data follows. + */ +} __attribute__((packed)); /* required for some archs */ + __attribute__ ((weak)) int ffsl(long int i) { return __builtin_ffsl(i); } void __openlog(const char *ident, int option, int facility); void passt_vsyslog(int pri, const char *format, va_list ap); -- cgit v1.2.3