summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorWilliam Tu <u9012063@gmail.com>2017-12-04 14:18:29 -0800
committerDaniel Borkmann <daniel@iogearbox.net>2017-12-04 23:22:31 +0100
commit792f3dd6f02b25afc0b42adce2efd523e81c3fb1 (patch)
tree22f64a223476b9ac796c5d812f2d57eebc5063c3 /net
parenta3fde2addd5f0218b64102005a237ef727b0dc30 (diff)
downloadop-kernel-dev-792f3dd6f02b25afc0b42adce2efd523e81c3fb1.zip
op-kernel-dev-792f3dd6f02b25afc0b42adce2efd523e81c3fb1.tar.gz
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 <u9012063@gmail.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/filter.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 8ec5a50..4d644ad 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3013,6 +3013,8 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
info->key.tun_flags = TUNNEL_KEY | TUNNEL_CSUM | TUNNEL_NOCACHE;
if (flags & BPF_F_DONT_FRAGMENT)
info->key.tun_flags |= TUNNEL_DONT_FRAGMENT;
+ if (flags & BPF_F_ZERO_CSUM_TX)
+ info->key.tun_flags &= ~TUNNEL_CSUM;
info->key.tun_id = cpu_to_be64(from->tunnel_id);
info->key.tos = from->tunnel_tos;
@@ -3028,9 +3030,6 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
info->key.u.ipv4.dst = cpu_to_be32(from->remote_ipv4);
}
- if (flags & BPF_F_ZERO_CSUM_TX)
- info->key.tun_flags &= ~TUNNEL_CSUM;
-
return 0;
}
OpenPOWER on IntegriCloud