From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH 03/22] passt: Drop <linux/ipv6.h> include, carry own ipv6hdr and opt_hdr definitions
Date: Fri, 28 Jan 2022 19:33:38 +0100 [thread overview]
Message-ID: <20220128183357.3407606-4-sbrivio@redhat.com> (raw)
In-Reply-To: <20220128183357.3407606-1-sbrivio@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 4999 bytes --]
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(a)redhat.com>
---
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 <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);
--
@@ -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);
--
2.33.0
next prev parent reply other threads:[~2022-01-28 18:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 18:33 [PATCH 00/22] Fixes for non-x86_64, older kernels/glibc, and some more Stefano Brivio
2022-01-28 18:33 ` [PATCH 01/22] tcp: Cover all usages of tcpi_snd_wnd with HAS_SND_WND Stefano Brivio
2022-01-28 18:33 ` [PATCH 02/22] tap, tcp: Fix two comparisons with different signedness reported by gcc 7 Stefano Brivio
2022-01-28 18:33 ` Stefano Brivio [this message]
2022-01-28 18:33 ` [PATCH 04/22] Makefile, seccomp: Fix build for i386, ppc64, ppc64le Stefano Brivio
2022-01-28 18:33 ` [PATCH 05/22] util: Fall-back definitions for SECCOMP_RET_KILL_PROCESS, ETH_{MAX,MIN}_MTU Stefano Brivio
2022-01-28 18:33 ` [PATCH 06/22] seccomp: Introduce mechanism to allow per-arch syscalls Stefano Brivio
2022-01-28 18:33 ` [PATCH 07/22] tcp, netlink, HAS{BYTES_ACKED,MIN_RTT,GETRANDOM} and NETLINK_GET_STRICT_CHK Stefano Brivio
2022-01-28 18:33 ` [PATCH 08/22] conf, pasta: Explicitly pass CLONE_{NEWUSER,NEWNET} to setns() Stefano Brivio
2022-01-28 18:33 ` [PATCH 09/22] tcp, udp, util: Fixes for bitmap handling on big-endian, casts Stefano Brivio
2022-01-28 18:33 ` [PATCH 10/22] netlink: Fix swapped v4/v6-only flags in external interface detection Stefano Brivio
2022-01-28 18:33 ` [PATCH 11/22] pasta: Check for zero d_reclen returned by getdents64() syscall Stefano Brivio
2022-01-28 18:33 ` [PATCH 12/22] tcp: Don't round down MSS to >= 64KiB page size, but clamp it in any case Stefano Brivio
2022-01-28 18:33 ` [PATCH 13/22] seccomp: Add a number of alternate and per-arch syscalls Stefano Brivio
2022-01-28 18:33 ` [PATCH 14/22] demo/pasta: Don't wait for pasta to return to a prompt Stefano Brivio
2022-01-28 18:33 ` [PATCH 15/22] test/two_guests: Drop stray spaces after sleep directives Stefano Brivio
2022-01-28 18:33 ` [PATCH 16/22] perf/passt_udp: Lower failure throughput thresholds with big MTUs Stefano Brivio
2022-01-28 18:33 ` [PATCH 17/22] test/lib/setup: Don't rely on IFS to properly separate qemu arguments Stefano Brivio
2022-01-28 18:33 ` [PATCH 18/22] test/lib/video: Drop -preset ultrafast from ffmpeg arguments Stefano Brivio
2022-01-28 18:33 ` [PATCH 19/22] hooks/pre-push: Delete old versions, add -DGLIBC_NO_STATIC_NSS, disable legacy builds Stefano Brivio
2022-01-28 18:33 ` [PATCH 20/22] conf: Fix support for --stderr as short option (-e) Stefano Brivio
2022-01-28 18:33 ` [PATCH 21/22] README: Fix anchor for Performance section Stefano Brivio
2022-01-28 18:33 ` [PATCH 22/22] README: Fix link to IGMP/MLD proxy ticket Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220128183357.3407606-4-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).