{"id":818031,"url":"http://patchwork.ozlabs.org/api/patches/818031/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170925032941.14586-3-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-3-tom@quantonium.net>","list_archive_url":null,"date":"2017-09-25T03:29:31","name":"[v3,net-next,02/12] vxlan: Call common functions to get tunnel routes","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"c6b9581e48a8c86b982d619634022d485d855689","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-3-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/818031/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818031/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=\"du7suHjl\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0qN26Vzbz9t4Z\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon, 25 Sep 2017 13:30:10 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932888AbdIYDaG (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 24 Sep 2017 23:30:06 -0400","from mail-pg0-f41.google.com ([74.125.83.41]:54616 \"EHLO\n\tmail-pg0-f41.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932698AbdIYDaE (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sun, 24 Sep 2017 23:30:04 -0400","by mail-pg0-f41.google.com with SMTP id c137so3272129pga.11\n\tfor <netdev@vger.kernel.org>; Sun, 24 Sep 2017 20:30:04 -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.02\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 24 Sep 2017 20:30:03 -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=atgSc7cSWpfP0yeG8RydMP5L2g1hZzx81Z5EoLNlTI8=;\n\tb=du7suHjlPK2GHQ45itWrZcR8IqVxBt3Cda0BwHk28ynckxkoUsQkh4RcpSXfhs6DdM\n\tjPXk6roJWg7Msg56gR321kgHJLxUmvoARL8Tcv39q5Q77ZFcdZ7lBI8CrOhDTLYZ5Pr4\n\t99QFAEZ4QL1eSV4aDXMsvjVudEwixDko5P5H46JIk3T2dvILEEPMEEY3EGRJcFygsfEK\n\t4gi0PO82Qz6vXYD4L0cR97hRhTC0/Zeq9GRJNuiv3Z0EP+SXEsimG12Ll4x6P5YVTike\n\tpWRCs8K7d9x4otA1gcycH/8hBSKNoqdhjk3uM4bN7MshafYH4E+PjS7ec3ho+6HqFku4\n\tsCdQ==","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=atgSc7cSWpfP0yeG8RydMP5L2g1hZzx81Z5EoLNlTI8=;\n\tb=qGsAO+6GIepssR6P+tnbRzECWyp9/Gr7A1xV4QS19nwOCJgeIhjRuF7J6cPZVqSWis\n\tlGPnb0LKrP7u3Ej7ClNfkfijfCPIXNP91DHuT2hHIErEGxdhaVqjfaGqmJSL6ruTokbe\n\t73bRJCm7bZlB0uhXv/9PJ5KvkhZen5ZGeMebIuu6iVcS/SBFge3A8qwNRXWab+3MBC0S\n\tSDvazLFtjhD/Br57vaDzlYg0YhsvzwN60Us9qzz0/e6b3Kl5EOmhJHD5Ms93AwzK9lZD\n\t50be0YUlGr+LmY0XiKRsKlP/utDUTLbjxhAnxB+Dpcep/hMFWcxui14dtEtimRiqyhG5\n\tmaVg==","X-Gm-Message-State":"AHPjjUhffeCVDSYSogZCtCGpItsu0ISNh04waWSnIvaoWGCsc8gJNvZH\n\t+VpFhDWqJ74QhHSxw3pIkPrVOw==","X-Google-Smtp-Source":"AOwi7QCHE3Jt6o06PlIyVCOLBTEbp1GZRLK8H5JfBU8jDL2t6tCH8NYHzJq3dJZWUugZ1xenNd1DxQ==","X-Received":"by 10.99.56.29 with SMTP id f29mr6343330pga.328.1506310204058;\n\tSun, 24 Sep 2017 20:30:04 -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 02/12] vxlan: Call common functions to get\n\ttunnel routes","Date":"Sun, 24 Sep 2017 20:29:31 -0700","Message-Id":"<20170925032941.14586-3-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":"Call ip_tunnel_get_route and ip6_tnl_get_route to handle getting a route\nand dealing with the dst_cache.\n\nSigned-off-by: Tom Herbert <tom@quantonium.net>\n---\n drivers/net/vxlan.c | 84 ++++-------------------------------------------------\n 1 file changed, 5 insertions(+), 79 deletions(-)","diff":"diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c\nindex d7c49cf1d5e9..810caa9adf37 100644\n--- a/drivers/net/vxlan.c\n+++ b/drivers/net/vxlan.c\n@@ -1867,47 +1867,11 @@ static struct rtable *vxlan_get_route(struct vxlan_dev *vxlan, struct net_device\n \t\t\t\t      struct dst_cache *dst_cache,\n \t\t\t\t      const struct ip_tunnel_info *info)\n {\n-\tbool use_cache = ip_tunnel_dst_cache_usable(skb, info);\n-\tstruct rtable *rt = NULL;\n-\tstruct flowi4 fl4;\n-\n \tif (!sock4)\n \t\treturn ERR_PTR(-EIO);\n \n-\tif (tos && !info)\n-\t\tuse_cache = false;\n-\tif (use_cache) {\n-\t\trt = dst_cache_get_ip4(dst_cache, saddr);\n-\t\tif (rt)\n-\t\t\treturn rt;\n-\t}\n-\n-\tmemset(&fl4, 0, sizeof(fl4));\n-\tfl4.flowi4_oif = oif;\n-\tfl4.flowi4_tos = RT_TOS(tos);\n-\tfl4.flowi4_mark = skb->mark;\n-\tfl4.flowi4_proto = IPPROTO_UDP;\n-\tfl4.daddr = daddr;\n-\tfl4.saddr = *saddr;\n-\tfl4.fl4_dport = dport;\n-\tfl4.fl4_sport = sport;\n-\n-\trt = ip_route_output_key(vxlan->net, &fl4);\n-\tif (likely(!IS_ERR(rt))) {\n-\t\tif (rt->dst.dev == dev) {\n-\t\t\tnetdev_dbg(dev, \"circular route to %pI4\\n\", &daddr);\n-\t\t\tip_rt_put(rt);\n-\t\t\treturn ERR_PTR(-ELOOP);\n-\t\t}\n-\n-\t\t*saddr = fl4.saddr;\n-\t\tif (use_cache)\n-\t\t\tdst_cache_set_ip4(dst_cache, &rt->dst, fl4.saddr);\n-\t} else {\n-\t\tnetdev_dbg(dev, \"no route to %pI4\\n\", &daddr);\n-\t\treturn ERR_PTR(-ENETUNREACH);\n-\t}\n-\treturn rt;\n+\treturn ip_tunnel_get_route(dev, skb, IPPROTO_UDP, oif, tos, daddr,\n+\t\t\t\t   saddr, dport, sport, dst_cache, info);\n }\n \n #if IS_ENABLED(CONFIG_IPV6)\n@@ -1922,50 +1886,12 @@ static struct dst_entry *vxlan6_get_route(struct vxlan_dev *vxlan,\n \t\t\t\t\t  struct dst_cache *dst_cache,\n \t\t\t\t\t  const struct ip_tunnel_info *info)\n {\n-\tbool use_cache = ip_tunnel_dst_cache_usable(skb, info);\n-\tstruct dst_entry *ndst;\n-\tstruct flowi6 fl6;\n-\tint err;\n-\n \tif (!sock6)\n \t\treturn ERR_PTR(-EIO);\n \n-\tif (tos && !info)\n-\t\tuse_cache = false;\n-\tif (use_cache) {\n-\t\tndst = dst_cache_get_ip6(dst_cache, saddr);\n-\t\tif (ndst)\n-\t\t\treturn ndst;\n-\t}\n-\n-\tmemset(&fl6, 0, sizeof(fl6));\n-\tfl6.flowi6_oif = oif;\n-\tfl6.daddr = *daddr;\n-\tfl6.saddr = *saddr;\n-\tfl6.flowlabel = ip6_make_flowinfo(RT_TOS(tos), label);\n-\tfl6.flowi6_mark = skb->mark;\n-\tfl6.flowi6_proto = IPPROTO_UDP;\n-\tfl6.fl6_dport = dport;\n-\tfl6.fl6_sport = sport;\n-\n-\terr = ipv6_stub->ipv6_dst_lookup(vxlan->net,\n-\t\t\t\t\t sock6->sock->sk,\n-\t\t\t\t\t &ndst, &fl6);\n-\tif (unlikely(err < 0)) {\n-\t\tnetdev_dbg(dev, \"no route to %pI6\\n\", daddr);\n-\t\treturn ERR_PTR(-ENETUNREACH);\n-\t}\n-\n-\tif (unlikely(ndst->dev == dev)) {\n-\t\tnetdev_dbg(dev, \"circular route to %pI6\\n\", daddr);\n-\t\tdst_release(ndst);\n-\t\treturn ERR_PTR(-ELOOP);\n-\t}\n-\n-\t*saddr = fl6.saddr;\n-\tif (use_cache)\n-\t\tdst_cache_set_ip6(dst_cache, ndst, saddr);\n-\treturn ndst;\n+\treturn ip6_tnl_get_route(dev, skb, sock6->sock->sk, IPPROTO_UDP, oif,\n+\t\t\t\t   tos, label, daddr, saddr, dport, sport,\n+\t\t\t\t   dst_cache, info);\n }\n #endif\n \n","prefixes":["v3","net-next","02/12"]}