Skip to content

Commit

Permalink
bpf: move bpf csum flag check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
William Tu authored and Daniel Borkmann committed Dec 4, 2017
1 parent a3fde2a commit 792f3dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 792f3dd

Please sign in to comment.