From 8218d990138b7da8411351488ea06243134ae37b Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 1 Aug 2023 13:36:46 +1000 Subject: Use C11 anonymous members to make poll refs less verbose to use union epoll_ref has a deeply nested set of structs and unions to let us subdivide it into the various different fields we want. This means that referencing elements can involve an awkward long string of intermediate fields. Using C11 anonymous structs and unions lets us do this less clumsily. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- passt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'passt.c') diff --git a/passt.c b/passt.c index 3b9b36b..9123868 100644 --- a/passt.c +++ b/passt.c @@ -75,14 +75,14 @@ static void sock_handler(struct ctx *c, union epoll_ref ref, { trace("%s: %s packet from socket %i (events: 0x%08x)", c->mode == MODE_PASST ? "passt" : "pasta", - IP_PROTO_STR(ref.r.proto), ref.r.s, events); + IP_PROTO_STR(ref.proto), ref.s, events); - if (!c->no_tcp && ref.r.proto == IPPROTO_TCP) + if (!c->no_tcp && ref.proto == IPPROTO_TCP) tcp_sock_handler( c, ref, events, now); - else if (!c->no_udp && ref.r.proto == IPPROTO_UDP) + else if (!c->no_udp && ref.proto == IPPROTO_UDP) udp_sock_handler( c, ref, events, now); else if (!c->no_icmp && - (ref.r.proto == IPPROTO_ICMP || ref.r.proto == IPPROTO_ICMPV6)) + (ref.proto == IPPROTO_ICMP || ref.proto == IPPROTO_ICMPV6)) icmp_sock_handler(c, ref, events, now); } -- cgit v1.2.3