Upstream commit:
    commit d5d5e8d55732c7c35c354e45e3b0af2795978a57
    Author: Haishuang Yan <yanhaishu...@cmss.chinamobile.com>
    Date:   Sat Jul 2 15:02:48 2016 +0800

    geneve: fix max_mtu setting

    For ipv6+udp+geneve encapsulation data, the max_mtu should subtract
    sizeof(ipv6hdr), instead of sizeof(iphdr).

    Signed-off-by: Haishuang Yan <yanhaishu...@cmss.chinamobile.com>
    Signed-off-by: David S. Miller <da...@davemloft.net>

Signed-off-by: Pravin B Shelar <pshe...@ovn.org>
---
 datapath/linux/compat/geneve.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c
index 834b34c..74e0cbc 100644
--- a/datapath/linux/compat/geneve.c
+++ b/datapath/linux/compat/geneve.c
@@ -1153,12 +1153,17 @@ static netdev_tx_t geneve_dev_xmit(struct sk_buff *skb, 
struct net_device *dev)
 
 static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool 
strict)
 {
+       struct geneve_dev *geneve = netdev_priv(dev);
        /* The max_mtu calculation does not take account of GENEVE
         * options, to avoid excluding potentially valid
         * configurations.
         */
-       int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - sizeof(struct iphdr)
-               - dev->hard_header_len;
+       int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - dev->hard_header_len;
+
+       if (geneve->remote.sa.sa_family == AF_INET6)
+               max_mtu -= sizeof(struct ipv6hdr);
+       else
+               max_mtu -= sizeof(struct iphdr);
 
        if (new_mtu < 68)
                return -EINVAL;
-- 
1.9.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to