public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Asbjørn Sloth Tønnesen" <asbjorn@asbjorn.st>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: James Chapman <jchapman@katalix.com>, netdev@vger.kernel.org
Subject: [PATCH iproute2 v2 6/9] l2tp: read IPv6 UDP checksum attributes from kernel
Date: Wed, 16 Nov 2016 22:45:23 +0000	[thread overview]
Message-ID: <20161116224526.32343-6-asbjorn@asbjorn.st> (raw)
In-Reply-To: <20161116224526.32343-1-asbjorn@asbjorn.st>

In case of an older kernel that doesn't set L2TP_ATTR_UDP_ZERO_CSUM6_{RX,TX}
the old hard-coded value is being preserved, since the attribute flag will be
missing.

Signed-off-by: Asbjørn Sloth Tønnesen <asbjorn@asbjorn.st>
---
 ip/ipl2tp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ip/ipl2tp.c b/ip/ipl2tp.c
index 03ca0cc..f5d4113 100644
--- a/ip/ipl2tp.c
+++ b/ip/ipl2tp.c
@@ -292,12 +292,9 @@ static int get_response(struct nlmsghdr *n, void *arg)
 	if (attrs[L2TP_ATTR_UDP_CSUM])
 		p->udp_csum = !!rta_getattr_u8(attrs[L2TP_ATTR_UDP_CSUM]);
 
-	/*
-	 * Not fetching from L2TP_ATTR_UDP_ZERO_CSUM6_{T,R}X because the
-	 * kernel doesn't send it so just leave it as default value.
-	 */
-	p->udp6_csum_tx = 1;
-	p->udp6_csum_rx = 1;
+	p->udp6_csum_tx = !attrs[L2TP_ATTR_UDP_ZERO_CSUM6_TX];
+	p->udp6_csum_rx = !attrs[L2TP_ATTR_UDP_ZERO_CSUM6_RX];
+
 	if (attrs[L2TP_ATTR_COOKIE])
 		memcpy(p->cookie, RTA_DATA(attrs[L2TP_ATTR_COOKIE]),
 		       p->cookie_len = RTA_PAYLOAD(attrs[L2TP_ATTR_COOKIE]));
-- 
2.10.2

  parent reply	other threads:[~2016-11-16 22:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-16 22:45 [PATCH iproute2 v2 1/9] man: ip-l2tp.8: fix l2spec_type documentation Asbjørn Sloth Tønnesen
2016-11-16 22:45 ` [PATCH iproute2 v2 2/9] man: ip-l2tp.8: remove non-existent tunnel parameter name Asbjørn Sloth Tønnesen
2016-11-16 22:45 ` [PATCH iproute2 v2 3/9] l2tp: fix integers with too few significant bits Asbjørn Sloth Tønnesen
2016-11-16 22:45 ` [PATCH iproute2 v2 4/9] l2tp: fix L2TP_ATTR_{RECV,SEND}_SEQ handling Asbjørn Sloth Tønnesen
2016-11-16 22:45 ` [PATCH iproute2 v2 5/9] l2tp: fix L2TP_ATTR_UDP_CSUM handling Asbjørn Sloth Tønnesen
2016-11-16 22:45 ` Asbjørn Sloth Tønnesen [this message]
2016-11-16 22:45 ` [PATCH iproute2 v2 7/9] l2tp: support sequence numbering Asbjørn Sloth Tønnesen
2016-11-16 22:45 ` [PATCH iproute2 v2 8/9] l2tp: show tunnel: expose UDP checksum state Asbjørn Sloth Tønnesen
2016-11-16 22:45 ` [PATCH iproute2 v2 9/9] man: ip-l2tp.8: document UDP checksum options Asbjørn Sloth Tønnesen
2016-11-29 21:43 ` [PATCH iproute2 v2 1/9] man: ip-l2tp.8: fix l2spec_type documentation Stephen Hemminger

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=20161116224526.32343-6-asbjorn@asbjorn.st \
    --to=asbjorn@asbjorn.st \
    --cc=jchapman@katalix.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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