netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH nft] netlink_linearize: fix IPv6 layer 4 checksum mangling
Date: Wed, 14 Dec 2016 01:19:26 +0100	[thread overview]
Message-ID: <1481674767-24986-1-git-send-email-pablo@netfilter.org> (raw)

In IPv6 there is no checksum field, so we have to trigger layer 4
checksum mangling when layer 3 pseudoheader fields are updated
inconditionally.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
Kernel patch is following up soon for nf.

 src/netlink_linearize.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/netlink_linearize.c b/src/netlink_linearize.c
index 4a0001a4ce17..0915038fecae 100644
--- a/src/netlink_linearize.c
+++ b/src/netlink_linearize.c
@@ -806,12 +806,11 @@ static void netlink_gen_payload_stmt(struct netlink_linearize_ctx *ctx,
 				   NFT_PAYLOAD_CSUM_INET);
 		nftnl_expr_set_u32(nle, NFTNL_EXPR_PAYLOAD_CSUM_OFFSET,
 				   csum_off / BITS_PER_BYTE);
-
-		if (expr->payload.base == PROTO_BASE_NETWORK_HDR &&
-		    payload_needs_l4csum_update_pseudohdr(expr, desc))
-			nftnl_expr_set_u32(nle, NFTNL_EXPR_PAYLOAD_FLAGS,
-					   NFT_PAYLOAD_L4CSUM_PSEUDOHDR);
 	}
+	if (expr->payload.base == PROTO_BASE_NETWORK_HDR &&
+	    payload_needs_l4csum_update_pseudohdr(expr, desc))
+		nftnl_expr_set_u32(nle, NFTNL_EXPR_PAYLOAD_FLAGS,
+				   NFT_PAYLOAD_L4CSUM_PSEUDOHDR);
 
 	nftnl_rule_add_expr(ctx->nlr, nle);
 }
-- 
2.1.4


                 reply	other threads:[~2016-12-14  0:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1481674767-24986-1-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@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).