Skip to content

Commit 792f3dd

Browse files
williamtuborkmann
authored andcommitted
bpf: move bpf csum flag check
trivial move the BPF_F_ZERO_CSUM_TX check right below the 'flags & BPF_F_DONT_FRAGMENT', so common tun_flags handling is logically together. Signed-off-by: William Tu <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent a3fde2a commit 792f3dd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

net/core/filter.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,6 +3013,8 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
30133013
info->key.tun_flags = TUNNEL_KEY | TUNNEL_CSUM | TUNNEL_NOCACHE;
30143014
if (flags & BPF_F_DONT_FRAGMENT)
30153015
info->key.tun_flags |= TUNNEL_DONT_FRAGMENT;
3016+
if (flags & BPF_F_ZERO_CSUM_TX)
3017+
info->key.tun_flags &= ~TUNNEL_CSUM;
30163018

30173019
info->key.tun_id = cpu_to_be64(from->tunnel_id);
30183020
info->key.tos = from->tunnel_tos;
@@ -3028,9 +3030,6 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
30283030
info->key.u.ipv4.dst = cpu_to_be32(from->remote_ipv4);
30293031
}
30303032

3031-
if (flags & BPF_F_ZERO_CSUM_TX)
3032-
info->key.tun_flags &= ~TUNNEL_CSUM;
3033-
30343033
return 0;
30353034
}
30363035

0 commit comments

Comments
 (0)