aboutgitcodebugslistschat
path: root/util.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-21 04:26:08 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-21 04:26:08 +0200
commitdd942eaa480a0744fd64844f34233900a0da6893 (patch)
tree42f048af444890506e208d0058c5cd3e03718667 /util.c
parent6257a2752e39c55bfb03d6db94af0c6033feb8df (diff)
downloadpasst-dd942eaa480a0744fd64844f34233900a0da6893.tar
passt-dd942eaa480a0744fd64844f34233900a0da6893.tar.gz
passt-dd942eaa480a0744fd64844f34233900a0da6893.tar.bz2
passt-dd942eaa480a0744fd64844f34233900a0da6893.tar.lz
passt-dd942eaa480a0744fd64844f34233900a0da6893.tar.xz
passt-dd942eaa480a0744fd64844f34233900a0da6893.tar.zst
passt-dd942eaa480a0744fd64844f34233900a0da6893.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/util.c b/util.c
index 6fb535c..5ecb43a 100644
--- a/util.c
+++ b/util.c
@@ -12,13 +12,11 @@
* Author: Stefano Brivio <sbrivio@redhat.com>
*/
-#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <unistd.h>
-#include <linux/ipv6.h>
#include <arpa/inet.h>
#include <net/ethernet.h>
#include <net/if.h>
@@ -34,6 +32,8 @@
#include <time.h>
#include <errno.h>
+#include <linux/ipv6.h>
+
#include "util.h"
#include "passt.h"
@@ -204,14 +204,16 @@ char *ipv6_l4hdr(struct ipv6hdr *ip6h, uint8_t *proto)
int sock_l4(struct ctx *c, int af, uint8_t proto, uint16_t port,
enum bind_type bind_addr, uint32_t data)
{
- union epoll_ref ref = { .proto = proto, .data = data };
+ union epoll_ref ref = { .r.proto = proto, .r.p.data = data };
struct sockaddr_in addr4 = {
.sin_family = AF_INET,
.sin_port = htons(port),
+ { 0 }, { 0 },
};
struct sockaddr_in6 addr6 = {
.sin6_family = AF_INET6,
.sin6_port = htons(port),
+ 0, IN6ADDR_ANY_INIT, 0,
};
const struct sockaddr *sa;
struct epoll_event ev;
@@ -229,7 +231,7 @@ int sock_l4(struct ctx *c, int af, uint8_t proto, uint16_t port,
perror("L4 socket");
return -1;
}
- ref.s = fd;
+ ref.r.s = fd;
if (af == AF_INET) {
if (bind_addr == BIND_LOOPBACK)