From 2743e58741b304c37858dbc44435a164215b0a87 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 21 Nov 2021 13:43:41 +0100 Subject: [PATCH] bpf: work around a verifier issue Force access to both src/dest fields, otherwise the llvm optimizer can turn this into pointer arithmetic that older kernels will reject Signed-off-by: Felix Fietkau --- qosify-bpf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qosify-bpf.c b/qosify-bpf.c index eb13e9b..a0635ec 100644 --- a/qosify-bpf.c +++ b/qosify-bpf.c @@ -258,10 +258,12 @@ parse_l4proto(struct qosify_config *config, struct __sk_buff *skb, return; } + src = READ_ONCE(udp->source); + dest = READ_ONCE(udp->dest); if (ingress) - key = udp->source; + key = src; else - key = udp->dest; + key = dest; if (proto == IPPROTO_TCP) { value = bpf_map_lookup_elem(&tcp_ports, &key); -- 2.30.2