diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2021-10-21 04:26:08 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2021-10-21 04:26:08 +0200 |
commit | dd942eaa480a0744fd64844f34233900a0da6893 (patch) | |
tree | 42f048af444890506e208d0058c5cd3e03718667 /dhcpv6.c | |
parent | 6257a2752e39c55bfb03d6db94af0c6033feb8df (diff) | |
download | passt-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 'dhcpv6.c')
-rw-r--r-- | dhcpv6.c | 27 |
1 files changed, 14 insertions, 13 deletions
@@ -12,19 +12,20 @@ * Author: Stefano Brivio <sbrivio@redhat.com> */ +#include <arpa/inet.h> +#include <net/if_arp.h> +#include <net/if.h> +#include <netinet/ip.h> +#include <netinet/udp.h> +#include <netinet/if_ether.h> #include <stdio.h> #include <stddef.h> #include <stdint.h> #include <unistd.h> #include <string.h> #include <time.h> -#include <arpa/inet.h> -#include <linux/if_ether.h> -#include <linux/ip.h> + #include <linux/ipv6.h> -#include <linux/udp.h> -#include <net/if.h> -#include <net/if_arp.h> #include "util.h" #include "passt.h" @@ -205,9 +206,9 @@ struct msg_hdr { } __attribute__((__packed__)); #if __BYTE_ORDER == __BIG_ENDIAN -#define UH_RESP { 547, 546, 0, 0, } +#define UH_RESP {{{ 547, 546, 0, 0, }}} #else -#define UH_RESP { __bswap_constant_16(547), __bswap_constant_16(546), 0, 0 } +#define UH_RESP {{{ __bswap_constant_16(547), __bswap_constant_16(546), 0, 0 }}} #endif /** @@ -316,26 +317,26 @@ static struct opt_hdr *dhcpv6_opt(struct opt_hdr *o, uint16_t type, size_t *len) /** * dhcpv6_ia_notonlink() - Check if any IA contains non-appropriate addresses * @o: First option header to check for IAs - * @len: Remaining message length, host order + * @rem_len: Remaining message length, host order * @addr: Address we want to lease to the client * * Return: pointer to non-appropriate IA_NA or IA_TA, if any, NULL otherwise */ -static struct opt_hdr *dhcpv6_ia_notonlink(struct opt_hdr *o, size_t len, +static struct opt_hdr *dhcpv6_ia_notonlink(struct opt_hdr *o, size_t rem_len, struct in6_addr *addr) { struct opt_hdr *ia, *ia_addr; char buf[INET6_ADDRSTRLEN]; struct in6_addr *req_addr; - size_t __len; + size_t len; int ia_type; ia_type = OPT_IA_NA; ia_ta: - __len = len; + len = rem_len; ia = o; - while ((ia = dhcpv6_opt(ia, ia_type, &__len))) { + while ((ia = dhcpv6_opt(ia, ia_type, &len))) { size_t ia_len = ntohs(ia->l); if (ia_type == OPT_IA_NA) { |