From dd942eaa480a0744fd64844f34233900a0da6893 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 21 Oct 2021 04:26:08 +0200 Subject: passt: Fix build with gcc 7, use std=c99, enable some more Clang checkers Unions and structs, you all have names now. Take the chance to enable bugprone-reserved-identifier, cert-dcl37-c, and cert-dcl51-cpp checkers in clang-tidy. Provide a ffsl() weak declaration using gcc built-in. Start reordering includes, but that's not enough for the llvm-include-order checker yet. Signed-off-by: Stefano Brivio --- passt.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'passt.c') diff --git a/passt.c b/passt.c index 846ba7f..ca4c279 100644 --- a/passt.c +++ b/passt.c @@ -19,7 +19,6 @@ * created in a separate network namespace). */ -#define _GNU_SOURCE #include #include #include @@ -32,15 +31,7 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include #include @@ -51,14 +42,20 @@ #include #include #include -#include -#include #include -#include #include -#include #include #include +#include +#include +#include + +#include +#include +#include +#include +#include +#include #include "seccomp.h" #include "util.h" @@ -100,14 +97,14 @@ static void sock_handler(struct ctx *c, union epoll_ref ref, uint32_t events, { debug("%s: %s packet from socket %i (events: 0x%08x)", c->mode == MODE_PASST ? "passt" : "pasta", - IP_PROTO_STR(ref.proto), ref.s, events); + IP_PROTO_STR(ref.r.proto), ref.r.s, events); - if (!c->no_tcp && ref.proto == IPPROTO_TCP) + if (!c->no_tcp && ref.r.proto == IPPROTO_TCP) tcp_sock_handler( c, ref, events, now); - else if (!c->no_udp && ref.proto == IPPROTO_UDP) + else if (!c->no_udp && ref.r.proto == IPPROTO_UDP) udp_sock_handler( c, ref, events, now); else if (!c->no_icmp && - (ref.proto == IPPROTO_ICMP || ref.proto == IPPROTO_ICMPV6)) + (ref.r.proto == IPPROTO_ICMP || ref.r.proto == IPPROTO_ICMPV6)) icmp_sock_handler(c, ref, events, now); } -- cgit v1.2.3