mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Xin Long <lucien.xin@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.11 21/46] ipv6: ip6_append_data_mtu do not handle the mtu of the second fragment properly
Date: Wed, 16 Apr 2014 11:31:37 +0100	[thread overview]
Message-ID: <1397644322-13905-22-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1397644322-13905-1-git-send-email-luis.henriques@canonical.com>

3.11.10.8 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: lucien <lucien.xin@gmail.com>

commit e367c2d03dba4c9bcafad24688fadb79dd95b218 upstream.

In ip6_append_data_mtu(), when the xfrm mode is not tunnel(such as
transport),the ipsec header need to be added in the first fragment, so the mtu
will decrease to reserve space for it, then the second fragment come, the mtu
should be turn back, as the commit 0c1833797a5a6ec23ea9261d979aa18078720b74
said.  however, in the commit a493e60ac4bbe2e977e7129d6d8cbb0dd236be, it use
*mtu = min(*mtu, ...) to change the mtu, which lead to the new mtu is alway
equal with the first fragment's. and cannot turn back.

when I test through  ping6 -c1 -s5000 $ip (mtu=1280):
...frag (0|1232) ESP(spi=0x00002000,seq=0xb), length 1232
...frag (1232|1216)
...frag (2448|1216)
...frag (3664|1216)
...frag (4880|164)

which should be:
...frag (0|1232) ESP(spi=0x00001000,seq=0x1), length 1232
...frag (1232|1232)
...frag (2464|1232)
...frag (3696|1232)
...frag (4928|116)

so delete the min() when change back the mtu.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Fixes: 75a493e60ac4bb ("ipv6: ip6_append_data_mtu did not care about pmtudisc and frag_size")
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.11: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 net/ipv6/ip6_output.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 554eb0d..b878dd6 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1110,21 +1110,19 @@ static void ip6_append_data_mtu(unsigned int *mtu,
 				unsigned int fragheaderlen,
 				struct sk_buff *skb,
 				struct rt6_info *rt,
-				bool pmtuprobe)
+				unsigned int orig_mtu)
 {
 	if (!(rt->dst.flags & DST_XFRM_TUNNEL)) {
 		if (skb == NULL) {
 			/* first fragment, reserve header_len */
-			*mtu = *mtu - rt->dst.header_len;
+			*mtu = orig_mtu - rt->dst.header_len;
 
 		} else {
 			/*
 			 * this fragment is not first, the headers
 			 * space is regarded as data space.
 			 */
-			*mtu = min(*mtu, pmtuprobe ?
-				   rt->dst.dev->mtu :
-				   dst_mtu(rt->dst.path));
+			*mtu = orig_mtu;
 		}
 		*maxfraglen = ((*mtu - fragheaderlen) & ~7)
 			      + fragheaderlen - sizeof(struct frag_hdr);
@@ -1141,7 +1139,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
 	struct ipv6_pinfo *np = inet6_sk(sk);
 	struct inet_cork *cork;
 	struct sk_buff *skb, *skb_prev = NULL;
-	unsigned int maxfraglen, fragheaderlen, mtu;
+	unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu;
 	int exthdrlen;
 	int dst_exthdrlen;
 	int hh_len;
@@ -1223,6 +1221,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
 		dst_exthdrlen = 0;
 		mtu = cork->fragsize;
 	}
+	orig_mtu = mtu;
 
 	hh_len = LL_RESERVED_SPACE(rt->dst.dev);
 
@@ -1302,8 +1301,7 @@ alloc_new_skb:
 			if (skb == NULL || skb_prev == NULL)
 				ip6_append_data_mtu(&mtu, &maxfraglen,
 						    fragheaderlen, skb, rt,
-						    np->pmtudisc ==
-						    IPV6_PMTUDISC_PROBE);
+						    orig_mtu);
 
 			skb_prev = skb;
 
-- 
1.9.1


  parent reply	other threads:[~2014-04-16 10:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16 10:31 [3.11.y.z extended stable] Linux 3.11.10.8 stable review Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 01/46] Input: cypress_ps2 - don't report as a button pads Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 02/46] netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 03/46] cpufreq: Fix timer/workqueue corruption due to double queueing Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 04/46] futex: Allow architectures to skip futex_atomic_cmpxchg_inatomic() test Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 05/46] m68k: Skip " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 06/46] powernow-k6: disable cache when changing frequency Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 07/46] powernow-k6: correctly initialize default parameters Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 08/46] powernow-k6: reorder frequencies Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 09/46] selinux: correctly label /proc inodes in use before the policy is loaded Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 10/46] net: fix for a race condition in the inet frag code Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 11/46] net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 12/46] bridge: multicast: add sanity check for query source addresses Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 13/46] inet: frag: make sure forced eviction removes all frags Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 14/46] net: unix: non blocking recvmsg() should not return -EINTR Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 15/46] ipv6: Fix exthdrs offload registration Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 16/46] ipv6: don't set DST_NOCOUNT for remotely added routes Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 17/46] vlan: Set correct source MAC address with TX VLAN offload enabled Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 18/46] tcp: tcp_release_cb() should release socket ownership Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 19/46] net: socket: error on a negative msg_namelen Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 20/46] ipv6: Avoid unnecessary temporary addresses being generated Luis Henriques
2014-04-16 10:31 ` Luis Henriques [this message]
2014-04-16 10:31 ` [PATCH 3.11 22/46] vxlan: fix potential NULL dereference in arp_reduce() Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 23/46] rtnetlink: fix fdb notification flags Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 24/46] ipmr: fix mfc " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 25/46] ip6mr: " Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 26/46] netpoll: fix the skb check in pkt_is_ns Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 27/46] tg3: Do not include vlan acceleration features in vlan_features Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 28/46] usbnet: include wait queue head in device structure Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 29/46] vlan: Set hard_header_len according to available acceleration Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 30/46] vhost: fix total length when packets are too short Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 31/46] vhost: validate vhost_get_vq_desc return value Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 32/46] xen-netback: remove pointless clause from if statement Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 33/46] ipv6: some ipv6 statistic counters failed to disable bh Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 34/46] netlink: don't compare the nul-termination in nla_strcmp Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 35/46] isdnloop: Validate NUL-terminated strings from user Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 36/46] isdnloop: several buffer overflows Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 37/46] rds: prevent dereference of a NULL device in rds_iw_laddr_check Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 38/46] cpuidle: Check the result of cpuidle_get_driver() against NULL Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 39/46] sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 40/46] Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines." Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 41/46] sparc32: fix build failure for arch_jump_label_transform Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 42/46] sparc64: don't treat 64-bit syscall return codes as 32-bit Luis Henriques
2014-04-16 10:31 ` [PATCH 3.11 43/46] sparc64: Make sure %pil interrupts are enabled during hypervisor yield Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 44/46] netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 45/46] netfilter: Can't fail and free after table replacement Luis Henriques
2014-04-16 10:32 ` [PATCH 3.11 46/46] crypto: ghash-clmulni-intel - use C implementation for setkey() Luis Henriques

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=1397644322-13905-22-git-send-email-luis.henriques@canonical.com \
    --to=luis.henriques@canonical.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=stable@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

all inboxes | Powered by JetHome®