netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Tu <u9012063@gmail.com>
To: netdev@vger.kernel.org
Cc: Daniel Borkmann <daniel@iogearbox.net>
Subject: [PATCH net-next 2/3] bpf: allow disabling tunnel csum for ipv6
Date: Fri,  1 Dec 2017 15:26:09 -0800	[thread overview]
Message-ID: <1512170770-7866-3-git-send-email-u9012063@gmail.com> (raw)
In-Reply-To: <1512170770-7866-1-git-send-email-u9012063@gmail.com>

Before the patch, BPF_F_ZERO_CSUM_TX can be used only for ipv4 tunnel.
With introduction of ip6gretap collect_md mode, the flag should be also
supported for ipv6.

Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
---
 net/core/filter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 6a85e67fafce..8ec5a504eb28 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3026,10 +3026,11 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
 				  IPV6_FLOWLABEL_MASK;
 	} else {
 		info->key.u.ipv4.dst = cpu_to_be32(from->remote_ipv4);
-		if (flags & BPF_F_ZERO_CSUM_TX)
-			info->key.tun_flags &= ~TUNNEL_CSUM;
 	}
 
+	if (flags & BPF_F_ZERO_CSUM_TX)
+		info->key.tun_flags &= ~TUNNEL_CSUM;
+
 	return 0;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2017-12-01 23:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 23:26 [PATCH net-next 0/3] add ip6 gre and gretap collect_md mode William Tu
2017-12-01 23:26 ` [PATCH net-next 1/3] ip6_gre: " William Tu
2017-12-01 23:26 ` William Tu [this message]
2017-12-04  8:33   ` [PATCH net-next 2/3] bpf: allow disabling tunnel csum for ipv6 Daniel Borkmann
2017-12-01 23:26 ` [PATCH net-next 3/3] samples/bpf: extend test_tunnel_bpf.sh with ip6gre William Tu
2017-12-04 16:11 ` [PATCH net-next 0/3] add ip6 gre and gretap collect_md mode David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1512170770-7866-3-git-send-email-u9012063@gmail.com \
    --to=u9012063@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).