{"id":818922,"url":"http://patchwork.ozlabs.org/api/patches/818922/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170927045803.2477-5-tom@quantonium.net/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170927045803.2477-5-tom@quantonium.net>","list_archive_url":null,"date":"2017-09-27T04:57:55","name":"[v4,net-next,04/12] iptunnel: Generalize tunnel update pmtu","commit_ref":null,"pull_url":null,"state":"deferred","archived":true,"hash":"1a406185adefe7c04ef9b125c10a791558ac6896","submitter":{"id":72064,"url":"http://patchwork.ozlabs.org/api/people/72064/?format=json","name":"Tom Herbert","email":"tom@quantonium.net"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170927045803.2477-5-tom@quantonium.net/mbox/","series":[{"id":5279,"url":"http://patchwork.ozlabs.org/api/series/5279/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=5279","date":"2017-09-27T04:57:51","name":"gtp: Additional feature support - Part I","version":4,"mbox":"http://patchwork.ozlabs.org/series/5279/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/818922/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818922/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=quantonium-net.20150623.gappssmtp.com\n\theader.i=@quantonium-net.20150623.gappssmtp.com\n\theader.b=\"fLIjmfSS\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y25FV0wGCz9t3h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 27 Sep 2017 14:58:54 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1033416AbdI0E6v (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 27 Sep 2017 00:58:51 -0400","from mail-pg0-f51.google.com ([74.125.83.51]:49835 \"EHLO\n\tmail-pg0-f51.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S970863AbdI0E6t (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 27 Sep 2017 00:58:49 -0400","by mail-pg0-f51.google.com with SMTP id m30so7130803pgn.6\n\tfor <netdev@vger.kernel.org>; Tue, 26 Sep 2017 21:58:48 -0700 (PDT)","from localhost.localdomain (c-73-162-13-107.hsd1.ca.comcast.net.\n\t[73.162.13.107]) by smtp.gmail.com with ESMTPSA id\n\ty16sm16502728pfe.68.2017.09.26.21.58.47\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 26 Sep 2017 21:58:47 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=quantonium-net.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=l7zd9/QVFOoCtjMrUcz5qK+0Oh109N5V5VJJNrKIpaQ=;\n\tb=fLIjmfSSmOaCpI8g7qCCUGDJLB66PHjplWMk8BYY2z7jw62cqA6QCbCYaPgEqjzE9i\n\tF9ZgoF3gw0ynYjblpAHBBLNCinPr00B1TMIPKdgYf/yIUXvkBGwIAuVS9K/sRAqoem2q\n\tTlpBf/eORPZ7lWTYONjMKV+2MrKVwVefeCcujncmQjUdZu264WMpd4G+wJIAD2oHXYSR\n\tGaNgDWhRXN42bFi4vJSjnWztM/5oArMxEa8moG9TdkhrFSnlfHUFyEUlTAWGyh8L2BP0\n\tueEm/WMPHoWcgYzc4Yyxit84RiJ/Osafqzy9UgjpCmAB8W14HM8b2p+BVMRnq+lj/sMO\n\tgjWQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=l7zd9/QVFOoCtjMrUcz5qK+0Oh109N5V5VJJNrKIpaQ=;\n\tb=A1tI1DcPbkcqRwgxTT9TJaqapukRKEL3W/x3U3D/ha01x4EtkfaEXdGV6YaJeUPAAs\n\t51tCU0K1qLgI3KpvUNqFlvXiu/KVfELgzCQrUEgx5IthmDnB2qdKCQmK6c8SPfpUznXJ\n\ttHTqRSonvNIYshvVtCanVrrYrTq1bhm8f3Db1cClOC/fAhyxQQ4RkvIVbt96XsEYmqxN\n\teXzccbY3lcEfUf0KWxk7ATcBSBsZ+TyxowI7LpoovOSUG6wxZnFvGAgZ78TmMWd1J3Jt\n\tHBCIscixHkzHjQaWogzcBeQs3GcmnuIGM2cil6Oqx0kG5ZsEhLtpXfd/GVJiyQza6+UM\n\ty+FQ==","X-Gm-Message-State":"AHPjjUg09Ypl3K1te5LRy9r2wamkweSIui28kSWH16ZumrEzkx689e7t\n\tGx+6fGSUJhw1ZrqhiXS9IqX6Z2Lm","X-Google-Smtp-Source":"AOwi7QAva+4NZKVLUpNo74c+ZBZAjcq1PExorMFvF6hIEspRoiZ6KFbALelaMdEAqKf+DAt32SrXsQ==","X-Received":"by 10.84.238.130 with SMTP id v2mr176953plk.175.1506488328647;\n\tTue, 26 Sep 2017 21:58:48 -0700 (PDT)","From":"Tom Herbert <tom@quantonium.net>","To":"davem@davemloft.net","Cc":"pablo@netfilter.org, laforge@gnumonks.org, aschultz@tpip.net,\n\tnetdev@vger.kernel.org, rohit@quantonium.net,\n\tTom Herbert <tom@quantonium.net>","Subject":"[PATCH v4 net-next 04/12] iptunnel: Generalize tunnel update pmtu","Date":"Tue, 26 Sep 2017 21:57:55 -0700","Message-Id":"<20170927045803.2477-5-tom@quantonium.net>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170927045803.2477-1-tom@quantonium.net>","References":"<20170927045803.2477-1-tom@quantonium.net>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Add __iptunnel_update_pmtu exported function which does not take\nan iptunnel argument but instead includes the fields from the\niptunnel structure as arguments which are needed in the function.\n\niptunnel_update_pmtu was modified to call __iptunnel_update_pmtu.\n\nSigned-off-by: Tom Herbert <tom@quantonium.net>\n---\n include/net/ip_tunnels.h |  4 ++++\n net/ipv4/ip_tunnel.c     | 30 ++++++++++++++++++++----------\n 2 files changed, 24 insertions(+), 10 deletions(-)","diff":"diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h\nindex 2b05ae24f4f6..be675836d35a 100644\n--- a/include/net/ip_tunnels.h\n+++ b/include/net/ip_tunnels.h\n@@ -317,6 +317,10 @@ static inline struct rtable *ip_tunnel_get_route(struct net_device *dev,\n \t\t\t\t     dst_cache, use_cache);\n }\n \n+int __iptunnel_update_pmtu(struct net_device *dev, struct sk_buff *skb,\n+\t\t\t   struct dst_entry *dst, __be16 df,\n+\t\t\t   const struct iphdr *inner_iph, int hlen, u32 daddr);\n+\n struct ip_tunnel_encap_ops {\n \tsize_t (*encap_hlen)(struct ip_tunnel_encap *e);\n \tint (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,\ndiff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c\nindex c97525d8dff9..0ee84ca76e0f 100644\n--- a/net/ipv4/ip_tunnel.c\n+++ b/net/ipv4/ip_tunnel.c\n@@ -506,17 +506,16 @@ int ip_tunnel_encap_setup(struct ip_tunnel *t,\n }\n EXPORT_SYMBOL_GPL(ip_tunnel_encap_setup);\n \n-static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,\n-\t\t\t    struct rtable *rt, __be16 df,\n-\t\t\t    const struct iphdr *inner_iph)\n+int __iptunnel_update_pmtu(struct net_device *dev, struct sk_buff *skb,\n+\t\t\t   struct dst_entry *dst, __be16 df,\n+\t\t\t   const struct iphdr *inner_iph, int hlen, u32 daddr)\n {\n-\tstruct ip_tunnel *tunnel = netdev_priv(dev);\n-\tint pkt_size = skb->len - tunnel->hlen - dev->hard_header_len;\n+\tint pkt_size = skb->len - hlen - dev->hard_header_len;\n \tint mtu;\n \n \tif (df)\n-\t\tmtu = dst_mtu(&rt->dst) - dev->hard_header_len\n-\t\t\t\t\t- sizeof(struct iphdr) - tunnel->hlen;\n+\t\tmtu = dst_mtu(dst) - dev->hard_header_len\n+\t\t\t\t   - sizeof(struct iphdr) - hlen;\n \telse\n \t\tmtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;\n \n@@ -538,8 +537,7 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,\n \n \t\tif (rt6 && mtu < dst_mtu(skb_dst(skb)) &&\n \t\t\t   mtu >= IPV6_MIN_MTU) {\n-\t\t\tif ((tunnel->parms.iph.daddr &&\n-\t\t\t    !ipv4_is_multicast(tunnel->parms.iph.daddr)) ||\n+\t\t\tif ((daddr && !ipv4_is_multicast(daddr)) ||\n \t\t\t    rt6->rt6i_dst.plen == 128) {\n \t\t\t\trt6->rt6i_flags |= RTF_MODIFIED;\n \t\t\t\tdst_metric_set(skb_dst(skb), RTAX_MTU, mtu);\n@@ -555,6 +553,17 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,\n #endif\n \treturn 0;\n }\n+EXPORT_SYMBOL(__iptunnel_update_pmtu);\n+\n+static int iptunnel_update_pmtu(struct net_device *dev, struct sk_buff *skb,\n+\t\t\t\tstruct rtable *rt, __be16 df,\n+\t\t\t\tconst struct iphdr *inner_iph)\n+{\n+\tstruct ip_tunnel *tunnel = netdev_priv(dev);\n+\n+\treturn __iptunnel_update_pmtu(dev, skb, &rt->dst, df, inner_iph,\n+\t\t\t\t      tunnel->hlen, tunnel->parms.iph.daddr);\n+}\n \n void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, u8 proto)\n {\n@@ -739,7 +748,8 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,\n \t\tgoto tx_error;\n \t}\n \n-\tif (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off, inner_iph)) {\n+\tif (iptunnel_update_pmtu(dev, skb, rt, tnl_params->frag_off,\n+\t\t\t\t inner_iph)) {\n \t\tip_rt_put(rt);\n \t\tgoto tx_error;\n \t}\n","prefixes":["v4","net-next","04/12"]}