aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-01-25 19:03:44 +0100
committerStefano Brivio <sbrivio@redhat.com>2022-01-26 07:57:09 +0100
commitb93c2c1713edf28815bb4057d04ff2dfb892c307 (patch)
tree4fc8639c6508f17428e2a057daf30bc7c1f28215
parentf6d9787d30c6a58ea6c4c1612b89f4bd5dd8cb68 (diff)
downloadpasst-b93c2c1713edf28815bb4057d04ff2dfb892c307.tar
passt-b93c2c1713edf28815bb4057d04ff2dfb892c307.tar.gz
passt-b93c2c1713edf28815bb4057d04ff2dfb892c307.tar.bz2
passt-b93c2c1713edf28815bb4057d04ff2dfb892c307.tar.lz
passt-b93c2c1713edf28815bb4057d04ff2dfb892c307.tar.xz
passt-b93c2c1713edf28815bb4057d04ff2dfb892c307.tar.zst
passt-b93c2c1713edf28815bb4057d04ff2dfb892c307.zip
passt: Drop <linux/ipv6.h> 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 <sbrivio@redhat.com>
-rw-r--r--arp.c2
-rw-r--r--conf.c2
-rw-r--r--dhcp.c2
-rw-r--r--dhcpv6.c2
-rw-r--r--icmp.c1
-rw-r--r--ndp.c1
-rw-r--r--netlink.c1
-rw-r--r--passt.c1
-rw-r--r--pasta.c2
-rw-r--r--pcap.c2
-rw-r--r--qrap.c2
-rw-r--r--tap.c1
-rw-r--r--tcp.c1
-rw-r--r--udp.c2
-rw-r--r--util.c2
-rw-r--r--util.h28
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 <unistd.h>
#include <string.h>
-#include <linux/ipv6.h>
-
#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 <netinet/in.h>
#include <netinet/if_ether.h>
-#include <linux/ipv6.h>
-
#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 <unistd.h>
#include <string.h>
-#include <linux/ipv6.h>
-
#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 <string.h>
#include <time.h>
-#include <linux/ipv6.h>
-
#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 <time.h>
#include <linux/icmpv6.h>
-#include <linux/ipv6.h>
#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 <net/if_arp.h>
#include <netinet/if_ether.h>
-#include <linux/ipv6.h>
#include <linux/icmpv6.h>
#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 <netinet/in.h>
#include <netinet/if_ether.h>
-#include <linux/ipv6.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
diff --git a/passt.c b/passt.c
index 6436a45..3581428 100644
--- a/passt.c
+++ b/passt.c
@@ -54,7 +54,6 @@
#include <linux/audit.h>
#include <linux/filter.h>
#include <linux/capability.h>
-#include <linux/ipv6.h>
#include <linux/icmpv6.h>
#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 <net/ethernet.h>
#include <sys/syscall.h>
-#include <linux/ipv6.h>
-
#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 <unistd.h>
#include <net/if.h>
-#include <linux/ipv6.h>
-
#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 <netinet/in.h>
#include <netinet/if_ether.h>
-#include <linux/ipv6.h>
-
#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 <netinet/if_ether.h>
#include <linux/if_tun.h>
-#include <linux/ipv6.h>
#include <linux/icmpv6.h>
#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 <unistd.h>
#include <time.h>
-#include <linux/ipv6.h>
#include <linux/tcp.h> /* 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 <unistd.h>
#include <time.h>
-#include <linux/ipv6.h>
-
#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 <time.h>
#include <errno.h>
-#include <linux/ipv6.h>
-
#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);