From c2cd1bdfdced5ec7b495e169cc4f247cc26220fb Mon Sep 17 00:00:00 2001 From: gamemann Date: Fri, 12 Nov 2021 17:36:14 +0000 Subject: [PATCH] Rename uint128_t to __u128 for organization. --- src/xdpfw.h | 2 +- src/xdpfw_kern.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/xdpfw.h b/src/xdpfw.h index 1e7c71e..7695556 100644 --- a/src/xdpfw.h +++ b/src/xdpfw.h @@ -21,7 +21,7 @@ #define ntohl(x) (x) #endif -#define uint128_t __uint128_t +#define __u128 __uint128_t #endif struct tcpopts diff --git a/src/xdpfw_kern.c b/src/xdpfw_kern.c index e50d960..ef7b953 100644 --- a/src/xdpfw_kern.c +++ b/src/xdpfw_kern.c @@ -68,7 +68,7 @@ struct bpf_map_def SEC("maps") ip_blacklist_map = struct bpf_map_def SEC("maps") ip6_stats_map = { .type = BPF_MAP_TYPE_LRU_HASH, - .key_size = sizeof(uint128_t), + .key_size = sizeof(__u128), .value_size = sizeof(struct ip_stats), .max_entries = MAX_TRACK_IPS }; @@ -76,7 +76,7 @@ struct bpf_map_def SEC("maps") ip6_stats_map = struct bpf_map_def SEC("maps") ip6_blacklist_map = { .type = BPF_MAP_TYPE_LRU_HASH, - .key_size = sizeof(uint128_t), + .key_size = sizeof(__u128), .value_size = sizeof(__u64), .max_entries = MAX_TRACK_IPS }; @@ -109,7 +109,7 @@ int xdp_prog_main(struct xdp_md *ctx) // Initialize IP headers. struct iphdr *iph; struct ipv6hdr *iph6; - uint128_t srcip6 = 0; + __u128 srcip6 = 0; // Set IPv4 and IPv6 common variables. if (ethhdr->h_proto == htons(ETH_P_IPV6)) @@ -121,10 +121,10 @@ int xdp_prog_main(struct xdp_md *ctx) return XDP_DROP; } - srcip6 |= (uint128_t) iph6->saddr.in6_u.u6_addr32[0] << 0; - srcip6 |= (uint128_t) iph6->saddr.in6_u.u6_addr32[1] << 32; - srcip6 |= (uint128_t) iph6->saddr.in6_u.u6_addr32[2] << 64; - srcip6 |= (uint128_t) iph6->saddr.in6_u.u6_addr32[3] << 96; + srcip6 |= (__u128) iph6->saddr.in6_u.u6_addr32[0] << 0; + srcip6 |= (__u128) iph6->saddr.in6_u.u6_addr32[1] << 32; + srcip6 |= (__u128) iph6->saddr.in6_u.u6_addr32[2] << 64; + srcip6 |= (__u128) iph6->saddr.in6_u.u6_addr32[3] << 96; } else {