]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.5/geneve-fix-max_mtu-setting.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / geneve-fix-max_mtu-setting.patch
1 From foo@baz Thu Jul 14 07:36:41 JST 2016
2 From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
3 Date: Sat, 2 Jul 2016 15:02:48 +0800
4 Subject: geneve: fix max_mtu setting
5
6 From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
7
8 [ Upstream commit d5d5e8d55732c7c35c354e45e3b0af2795978a57 ]
9
10 For ipv6+udp+geneve encapsulation data, the max_mtu should subtract
11 sizeof(ipv6hdr), instead of sizeof(iphdr).
12
13 Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 ---
17 drivers/net/geneve.c | 9 +++++++--
18 1 file changed, 7 insertions(+), 2 deletions(-)
19
20 --- a/drivers/net/geneve.c
21 +++ b/drivers/net/geneve.c
22 @@ -1092,12 +1092,17 @@ static netdev_tx_t geneve_xmit(struct sk
23
24 static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool strict)
25 {
26 + struct geneve_dev *geneve = netdev_priv(dev);
27 /* The max_mtu calculation does not take account of GENEVE
28 * options, to avoid excluding potentially valid
29 * configurations.
30 */
31 - int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - sizeof(struct iphdr)
32 - - dev->hard_header_len;
33 + int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - dev->hard_header_len;
34 +
35 + if (geneve->remote.sa.sa_family == AF_INET6)
36 + max_mtu -= sizeof(struct ipv6hdr);
37 + else
38 + max_mtu -= sizeof(struct iphdr);
39
40 if (new_mtu < 68)
41 return -EINVAL;