Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/815215/?format=api
{ "id": 815215, "url": "http://patchwork.ozlabs.org/api/patches/815215/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170919003904.5124-2-tom@quantonium.net/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "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": "<20170919003904.5124-2-tom@quantonium.net>", "list_archive_url": null, "date": "2017-09-19T00:38:51", "name": "[net-next,01/14] iptunnel: Add common functions to get a tunnel route", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "19f64372ab0506c0243fd757e8c914db4a1a29d1", "submitter": { "id": 72064, "url": "http://patchwork.ozlabs.org/api/people/72064/?format=api", "name": "Tom Herbert", "email": "tom@quantonium.net" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170919003904.5124-2-tom@quantonium.net/mbox/", "series": [ { "id": 3758, "url": "http://patchwork.ozlabs.org/api/series/3758/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=3758", "date": "2017-09-19T00:38:50", "name": "gtp: Additional feature support", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3758/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/815215/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/815215/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=\"aGB3SSwH\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xx3tK6LRDz9s78\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 10:39:53 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751210AbdISAjd (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 18 Sep 2017 20:39:33 -0400", "from mail-pf0-f169.google.com ([209.85.192.169]:54195 \"EHLO\n\tmail-pf0-f169.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751016AbdISAjc (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 18 Sep 2017 20:39:32 -0400", "by mail-pf0-f169.google.com with SMTP id x78so1102618pff.10\n\tfor <netdev@vger.kernel.org>; Mon, 18 Sep 2017 17:39:32 -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\tk78sm662018pfb.157.2017.09.18.17.39.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 18 Sep 2017 17:39:30 -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=p4/uHanYkSLTDDyJ1/R/fpW4eCV1EFLfoTQrShRbRC8=;\n\tb=aGB3SSwH67gCDaTTQ0FDQsgngY3ipBgrS1Pz83AYOc/URQ18q5HEf1EV94/6r5Ctf4\n\tkpGLXlVEYyji7lRJgF0x6S5UEhLo20ZVDNYr+s+8yCUkxepFpTyvvkH6GvKd2sDLAv29\n\tXdtqcn3qbjVwT5/hliApZhpmD5rByFPS5Blftu0pExXdkwdoRIDqeJrc7wLBFekF9VqJ\n\tx2zHQZARaIts47OSjSlMsNwqsrOyIDV78Ha9EAM1SjNEYjcjpUtYUGhYZhYThL2Nhhuq\n\tphLuPRNPpC3q3ZsOVrG4/LZptuH9vGfhx3SjBVvNq6Y00CQhh9cm5eH88lpiXRcXWEHv\n\tgZCg==", "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=p4/uHanYkSLTDDyJ1/R/fpW4eCV1EFLfoTQrShRbRC8=;\n\tb=CUw32eg/RQl9vdK8Yy4FqNvAsZwS1VdxV1uKBeC9a6pPSyLg5/SA7qqJKXejkfTXgk\n\tAzV5TElbQRsgJYdOqyV9pSUKL5wESTbB4N3SbOI/5+JGDWBLY+GgZQGDZnJKhzrLGF77\n\thQETtT4rUF3Wr9mD68t+C1rbrKm0zriB2Lsd/shcpPfo2STDs6wWNF+Rijc55AYqDSiP\n\tllpaKI6Fw23D8Qz3iQgDCHndknNGJcCkEfc9qy/CifmVHLRg+wYCjA/2ZwuFpS++93vQ\n\tEPS4D3fU6pqKP90L5qRNjxK3zDxxRUA6kRxZxJ+NsJjXGd4e1Y6uAfGBQFe9n14vLckE\n\t3J0g==", "X-Gm-Message-State": "AHPjjUgF+zh/+Pyw7R1sC01q24y6YdkugAXa+0VBlrSYfznM4UIDO7Lb\n\tFqbewgPUuTLfQB9F", "X-Google-Smtp-Source": "AOwi7QDhjPzJ7ATztsS5JtBG8Z3TJi6DU9Ikbx+L667Y/GKW6L0OzxWP6TxvyvW+Wnw32hyI7VzNnQ==", "X-Received": "by 10.101.83.4 with SMTP id m4mr353506pgq.266.1505781571883;\n\tMon, 18 Sep 2017 17:39:31 -0700 (PDT)", "From": "Tom Herbert <tom@quantonium.net>", "To": "davem@davemloft.net", "Cc": "netdev@vger.kernel.org, pablo@netfilter.org, laforge@gnumonks.org,\n\trohit@quantonium.net, Tom Herbert <tom@quantonium.net>", "Subject": "[PATCH net-next 01/14] iptunnel: Add common functions to get a\n\ttunnel route", "Date": "Mon, 18 Sep 2017 17:38:51 -0700", "Message-Id": "<20170919003904.5124-2-tom@quantonium.net>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170919003904.5124-1-tom@quantonium.net>", "References": "<20170919003904.5124-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": "ip_tunnel_get_route and ip6_tnl_get_route are create to return\nroutes for a tunnel. These functions are derived from the VXLAN\nfunctions.\n\nSigned-off-by: Tom Herbert <tom@quantonium.net>\n---\n include/net/ip6_tunnel.h | 33 +++++++++++++++++++++++++++++++++\n include/net/ip_tunnels.h | 33 +++++++++++++++++++++++++++++++++\n net/ipv4/ip_tunnel.c | 41 +++++++++++++++++++++++++++++++++++++++++\n net/ipv6/ip6_tunnel.c | 43 +++++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 150 insertions(+)", "diff": "diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h\nindex 08fbc7f7d8d7..233097bf07a2 100644\n--- a/include/net/ip6_tunnel.h\n+++ b/include/net/ip6_tunnel.h\n@@ -142,6 +142,39 @@ __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,\n struct net *ip6_tnl_get_link_net(const struct net_device *dev);\n int ip6_tnl_get_iflink(const struct net_device *dev);\n int ip6_tnl_change_mtu(struct net_device *dev, int new_mtu);\n+struct dst_entry *__ip6_tnl_get_route(struct net_device *dev,\n+\t\t\t\t struct sk_buff *skb, struct sock *sk,\n+\t\t\t\t u8 proto, int oif, u8 tos, __be32 label,\n+\t\t\t\t const struct in6_addr *daddr,\n+\t\t\t\t struct in6_addr *saddr,\n+\t\t\t\t __be16 dport, __be16 sport,\n+\t\t\t\t struct dst_cache *dst_cache,\n+\t\t\t\t const struct ip_tunnel_info *info,\n+\t\t\t\t bool use_cache);\n+\n+static inline struct dst_entry *ip6_tnl_get_route(struct net_device *dev,\n+\t\t\tstruct sk_buff *skb, struct sock *sk, u8 proto,\n+\t\t\tint oif, u8 tos, __be32 label,\n+\t\t\tconst struct in6_addr *daddr,\n+\t\t\tstruct in6_addr *saddr,\n+\t\t\t__be16 dport, __be16 sport,\n+\t\t\tstruct dst_cache *dst_cache,\n+\t\t\tconst struct ip_tunnel_info *info)\n+{\n+\t bool use_cache = (ip_tunnel_dst_cache_usable(skb, info) &&\n+\t\t(!tos || info));\n+\n+\tif (use_cache) {\n+\t\tstruct dst_entry *ndst = dst_cache_get_ip6(dst_cache, saddr);\n+\n+\t\tif (ndst)\n+\t\t\treturn ndst;\n+\t}\n+\n+\treturn __ip6_tnl_get_route(dev, skb, sk, proto, oif, tos, label,\n+\t\t\t\t daddr, saddr, dport, sport, dst_cache,\n+\t\t\t\t info, use_cache);\n+}\n \n static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,\n \t\t\t\t struct net_device *dev)\ndiff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h\nindex 992652856fe8..91d5150a1044 100644\n--- a/include/net/ip_tunnels.h\n+++ b/include/net/ip_tunnels.h\n@@ -284,6 +284,39 @@ int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],\n \t\t struct ip_tunnel_parm *p, __u32 fwmark);\n void ip_tunnel_setup(struct net_device *dev, unsigned int net_id);\n \n+struct rtable *__ip_tunnel_get_route(struct net_device *dev,\n+\t\t\t\t struct sk_buff *skb, u8 proto,\n+\t\t\t\t int oif, u8 tos,\n+\t\t\t\t __be32 daddr, __be32 *saddr,\n+\t\t\t\t __be16 dport, __be16 sport,\n+\t\t\t\t struct dst_cache *dst_cache,\n+\t\t\t\t const struct ip_tunnel_info *info,\n+\t\t\t\t bool use_cache);\n+\n+static inline struct rtable *ip_tunnel_get_route(struct net_device *dev,\n+\t\t\t\t struct sk_buff *skb, u8 proto,\n+\t\t\t\t int oif, u8 tos,\n+\t\t\t\t __be32 daddr, __be32 *saddr,\n+\t\t\t\t __be16 dport, __be16 sport,\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+\t\t(!tos || info));\n+\n+\tif (use_cache) {\n+\t\tstruct rtable *rt;\n+\n+\t\trt = dst_cache_get_ip4(dst_cache, saddr);\n+\t\tif (rt)\n+\t\t\treturn rt;\n+\t}\n+\n+\treturn __ip_tunnel_get_route(dev, skb, proto, oif, tos,\n+\t\t\t\t daddr, saddr, dport, sport,\n+\t\t\t\t dst_cache, info, use_cache);\n+}\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 e9805ad664ac..f0f35333febd 100644\n--- a/net/ipv4/ip_tunnel.c\n+++ b/net/ipv4/ip_tunnel.c\n@@ -935,6 +935,47 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd)\n }\n EXPORT_SYMBOL_GPL(ip_tunnel_ioctl);\n \n+struct rtable *__ip_tunnel_get_route(struct net_device *dev,\n+\t\t\t\t struct sk_buff *skb, u8 proto,\n+\t\t\t\t int oif, u8 tos,\n+\t\t\t\t __be32 daddr, __be32 *saddr,\n+\t\t\t\t __be16 dport, __be16 sport,\n+\t\t\t\t struct dst_cache *dst_cache,\n+\t\t\t\t const struct ip_tunnel_info *info,\n+\t\t\t\t bool use_cache)\n+{\n+\tstruct rtable *rt = NULL;\n+\tstruct flowi4 fl4;\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 = proto;\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(dev_net(dev), &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+}\n+EXPORT_SYMBOL_GPL(__ip_tunnel_get_route);\n+\n int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict)\n {\n \tstruct ip_tunnel *tunnel = netdev_priv(dev);\ndiff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c\nindex ae73164559d5..9a02b62c808b 100644\n--- a/net/ipv6/ip6_tunnel.c\n+++ b/net/ipv6/ip6_tunnel.c\n@@ -1663,6 +1663,49 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)\n \treturn err;\n }\n \n+struct dst_entry *__ip6_tnl_get_route(struct net_device *dev,\n+\t\t\t\t struct sk_buff *skb, struct sock *sk,\n+\t\t\t\t u8 proto, int oif, u8 tos, __be32 label,\n+\t\t\t\t const struct in6_addr *daddr,\n+\t\t\t\t struct in6_addr *saddr,\n+\t\t\t\t __be16 dport, __be16 sport,\n+\t\t\t\t struct dst_cache *dst_cache,\n+\t\t\t\t const struct ip_tunnel_info *info,\n+\t\t\t\t bool use_cache)\n+{\n+\tstruct dst_entry *ndst;\n+\tstruct flowi6 fl6;\n+\tint err;\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 = proto;\n+\tfl6.fl6_dport = dport;\n+\tfl6.fl6_sport = sport;\n+\n+\terr = ipv6_stub->ipv6_dst_lookup(dev_net(dev), sk, &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+}\n+EXPORT_SYMBOL_GPL(__ip6_tnl_get_route);\n+\n /**\n * ip6_tnl_change_mtu - change mtu manually for tunnel device\n * @dev: virtual device associated with tunnel\n", "prefixes": [ "net-next", "01/14" ] }