{"id":818033,"url":"http://patchwork.ozlabs.org/api/patches/818033/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170925032941.14586-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":"<20170925032941.14586-5-tom@quantonium.net>","list_archive_url":null,"date":"2017-09-25T03:29:33","name":"[v3,net-next,04/12] iptunnel: Generalize tunnel update pmtu","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"93397b0d1632a6baa65ec683772527985cbe8730","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/20170925032941.14586-5-tom@quantonium.net/mbox/","series":[{"id":4865,"url":"http://patchwork.ozlabs.org/api/series/4865/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4865","date":"2017-09-25T03:29:29","name":"gtp: Additional feature support - Part I","version":3,"mbox":"http://patchwork.ozlabs.org/series/4865/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/818033/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818033/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=\"u4NC64+N\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0qN56fFvz9t4B\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 25 Sep 2017 13:30:13 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932967AbdIYDaM (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 24 Sep 2017 23:30:12 -0400","from mail-pf0-f180.google.com ([209.85.192.180]:53657 \"EHLO\n\tmail-pf0-f180.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932893AbdIYDaK (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 24 Sep 2017 23:30:10 -0400","by mail-pf0-f180.google.com with SMTP id x78so3134972pff.10\n\tfor <netdev@vger.kernel.org>; Sun, 24 Sep 2017 20:30:10 -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\tj2sm9112907pgn.26.2017.09.24.20.30.07\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 24 Sep 2017 20:30:07 -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=oZKveqoes9D18SVp3KtzsiipJgaPIVkzyRcXKyWNBJ0=;\n\tb=u4NC64+NXVmy6qVxb9X5DCcWZ2ZLiWBQf02WSQu8TZBjKOV0D0liWK1QRlVp6GfsLZ\n\tB3xCUhnfPsxV7IQ+cRgf5rD9KzF7mPbGI20m2k0KTSkyXsFqOvQvavLCxPB6meW+Egwk\n\t4cV4kMXehL2Pqbu0azkMmIYm4F/NzL+ZFjvcxlY+9V/Ul0jBFP9pLAclEXPzI3gylHJk\n\ttamp25MloUaU9s3ntgwXVtGGbweqwdp/meWSURdSvxFmOZiPhQWc/l3PtoeEpH3/+4I1\n\tqEWZIlUDNQ7Zf8upU4kOza9cWB0M/105koBPSk9xDMPZkirEe1T3ylGE2nWkfkCxCvnI\n\tXGUw==","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=oZKveqoes9D18SVp3KtzsiipJgaPIVkzyRcXKyWNBJ0=;\n\tb=T2Rn1XAiHZ5L+C5SxKvwEaQFrz3ugXJ3NPUd0WeJQ1xG2ykwrYe3JarE3eDvk+LQ6v\n\tfyAZ6oaRePagVg1xAOG52ElhDrYi2P0LGBsJxwezrg4FUTNve18OvQ9opypMGe+mErYi\n\t6cUm/rzZOGmrlbC2veZAZFR99vs0Vb6Ua+QPTqhTiGBYdO1zkYwlt65q5cpXeWAfr8e6\n\tfsKl9t5o4aKn8TerVqoW9dQkbd5OL4YTppPCBHfImvcjiRmq9qqmVhPKBEcmdVJ9COVe\n\txOQgnP6rzKibKdRzP8S+gH/g+qPYsIN31DVQmCHb6qQX0s4K35Pgg3G71w1st3zANcGZ\n\t3Pcw==","X-Gm-Message-State":"AHPjjUjvpW70MRsnihuxMUd57nXgH67TNTHwY/Nx+mdrrfMkLUcu17x4\n\tg/FbmmzcLTujouVvms+SQw5yNZO5","X-Google-Smtp-Source":"AOwi7QCnWKs/ObOBjmZ4+aPbqLQ8o1C6OtqMmENh/tLM/TSfsMOREYCH/SOIKIsvWZ7UlrwPXvOKtQ==","X-Received":"by 10.99.126.87 with SMTP id o23mr6180129pgn.277.1506310209589; \n\tSun, 24 Sep 2017 20:30:09 -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 v3 net-next 04/12] iptunnel: Generalize tunnel update pmtu","Date":"Sun, 24 Sep 2017 20:29:33 -0700","Message-Id":"<20170925032941.14586-5-tom@quantonium.net>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170925032941.14586-1-tom@quantonium.net>","References":"<20170925032941.14586-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 9650efff33d7..880c9ea5b08c 100644\n--- a/include/net/ip_tunnels.h\n+++ b/include/net/ip_tunnels.h\n@@ -318,6 +318,10 @@ static inline struct rtable *ip_tunnel_get_route(struct net_device *dev,\n \t\t\t\t     dst_cache, info, 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 ea8f8bc0aaf9..31d6dc9f6859 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":["v3","net-next","04/12"]}