Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/815228/?format=api
{ "id": 815228, "url": "http://patchwork.ozlabs.org/api/patches/815228/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170919003904.5124-9-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-9-tom@quantonium.net>", "list_archive_url": null, "date": "2017-09-19T00:38:58", "name": "[net-next,08/14] gtp: Support encpasulating over IPv6", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "ba38e3b3ac45d1bdad2580f56e60f87615f3a214", "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-9-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/815228/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/815228/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=\"eE2Q3JDP\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xx3v14H84z9s78\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 19 Sep 2017 10:40:29 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751584AbdISAk2 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 18 Sep 2017 20:40:28 -0400", "from mail-pg0-f44.google.com ([74.125.83.44]:50966 \"EHLO\n\tmail-pg0-f44.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751462AbdISAjv (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 18 Sep 2017 20:39:51 -0400", "by mail-pg0-f44.google.com with SMTP id p5so1089160pgn.7\n\tfor <netdev@vger.kernel.org>; Mon, 18 Sep 2017 17:39:51 -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.49\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 18 Sep 2017 17:39:50 -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=U/2Id3hY7HV6sGPlDyytYA6bhvTRn/VUCGO5tu8eL7U=;\n\tb=eE2Q3JDP354zV22ZvA/w7iag7OGXwpNVsgdz1J7Kfh9X/YndUyEYIr0pq1K7mNfOJT\n\tXx+Ev5QCEzYSuiTuOEXSITxAK/psaZtqOVLJM8o3zS/6+iM6sWngp6T8Uwk/eMGxgMbZ\n\t3mjMXkIr7BtS4wR+ImdD+T+4FlAFbjmBTrKAJp63cwN8JNV8wi35qsEsobHIRmPk7z7N\n\t3XspzYk6yThmthvsAz5GJld2v6zFBlks+LX7N0zkgc2tKLtlqbsXWMHunKcFXKlVBR1w\n\tNot+NGdeCpbUI0R9CSTB0qMWKC7Ng7fAQ5CgtojTeHLlPsrWUMDvb6zn4q/4sVPl0GzB\n\tDrbw==", "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=U/2Id3hY7HV6sGPlDyytYA6bhvTRn/VUCGO5tu8eL7U=;\n\tb=jp1AQaG3K6/NHdSrlHhbEN2qFQcdCDRTVZBILN+cV7/oPO1YOqRmM4nZRMeRSN7xVp\n\tjLlscN+uuKP5PbHWUMvEM+kaOZELdHjgw8CfFBz1ujB7AVDUMbbgjtf/B5lSuIdHJzcW\n\thViTaAefJTSC8jNClUi0JvSqSHrV1iltTJH1WfvcAXD0HRRdWp0Hh7dejLfE9y1TeYP0\n\tyZpesNcV1E60zCKFp3Ac4Pfn8kdHn8asmIbvJ87Tn57L9ZxNBhDwKd9WfhDv7KzChjvm\n\tRuPbXO8gySBvYPIM6iUY6339X3Rgmzbha51EepKa6QrxXTSPkapjyFrQWN/FHXD5YajT\n\tBEng==", "X-Gm-Message-State": "AHPjjUiV5McLoX9JTVowdFgemWrV8a/k3hzg4naN3hAY+1jrV50fe5LY\n\tQgf88osu0Tyd9SI9", "X-Google-Smtp-Source": "AOwi7QDtEXPdmXyc61L2RUPMwCCHbLMSmo0aVmpeEWo/qXo35UIxAPOIGXvQdqf2lYftRvpITe1mSA==", "X-Received": "by 10.84.244.73 with SMTP id e9mr371720plt.112.1505781591318;\n\tMon, 18 Sep 2017 17:39:51 -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 08/14] gtp: Support encpasulating over IPv6", "Date": "Mon, 18 Sep 2017 17:38:58 -0700", "Message-Id": "<20170919003904.5124-9-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": "Allow peers to be specified by IPv6 addresses.\n\nSigned-off-by: Tom Herbert <tom@quantonium.net>\n---\n drivers/net/gtp.c | 198 +++++++++++++++++++++++++++++++++----------\n include/uapi/linux/gtp.h | 1 +\n include/uapi/linux/if_link.h | 3 +\n 3 files changed, 158 insertions(+), 44 deletions(-)", "diff": "diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c\nindex 62c0c968efa6..121b41e7a901 100644\n--- a/drivers/net/gtp.c\n+++ b/drivers/net/gtp.c\n@@ -28,6 +28,7 @@\n #include <net/net_namespace.h>\n #include <net/protocol.h>\n #include <net/ip.h>\n+#include <net/ip6_tunnel.h>\n #include <net/udp.h>\n #include <net/udp_tunnel.h>\n #include <net/icmp.h>\n@@ -61,7 +62,11 @@ struct pdp_ctx {\n \t\tstruct in6_addr\tms_addr_ip6;\n \t};\n \n-\tstruct in_addr\t\tpeer_addr_ip4;\n+\tu16\t\t\tpeer_af;\n+\tunion {\n+\t\tstruct in_addr\tpeer_addr_ip4;\n+\t\tstruct in6_addr\tpeer_addr_ip6;\n+\t};\n \n \tstruct sock\t\t*sk;\n \tstruct net_device *dev;\n@@ -76,6 +81,8 @@ struct pdp_ctx {\n struct gtp_dev {\n \tstruct list_head\tlist;\n \n+\tunsigned int\t\tis_ipv6:1;\n+\n \tstruct sock\t\t*sk0;\n \tstruct sock\t\t*sk1u;\n \n@@ -515,8 +522,6 @@ static int gtp_xmit(struct sk_buff *skb, struct net_device *dev,\n \t\t struct pdp_ctx *pctx)\n {\n \tstruct sock *sk = pctx->sk;\n-\t__be32 saddr = inet_sk(sk)->inet_saddr;\n-\tstruct rtable *rt;\n \tint err = 0;\n \n \t/* Ensure there is sufficient headroom. */\n@@ -526,28 +531,63 @@ static int gtp_xmit(struct sk_buff *skb, struct net_device *dev,\n \n \tskb_reset_inner_headers(skb);\n \n-\trt = ip_tunnel_get_route(dev, skb, sk->sk_protocol,\n-\t\t\t\t sk->sk_bound_dev_if, RT_CONN_FLAGS(sk),\n-\t\t\t\t pctx->peer_addr_ip4.s_addr, &saddr,\n-\t\t\t\t pctx->gtp_port, pctx->gtp_port,\n-\t\t\t\t &pctx->dst_cache, NULL);\n+\tif (pctx->peer_af == AF_INET) {\n+\t\t__be32 saddr = inet_sk(sk)->inet_saddr;\n+\t\tstruct rtable *rt;\n \n-\tif (IS_ERR(rt)) {\n-\t\terr = PTR_ERR(rt);\n-\t\tgoto out_err;\n-\t}\n+\t\trt = ip_tunnel_get_route(dev, skb, sk->sk_protocol,\n+\t\t\t\t\t sk->sk_bound_dev_if, RT_CONN_FLAGS(sk),\n+\t\t\t\t\t pctx->peer_addr_ip4.s_addr, &saddr,\n+\t\t\t\t\t pctx->gtp_port, pctx->gtp_port,\n+\t\t\t\t\t &pctx->dst_cache, NULL);\n+\n+\t\tif (IS_ERR(rt)) {\n+\t\t\terr = PTR_ERR(rt);\n+\t\t\tgoto out_err;\n+\t\t}\n+\n+\t\tskb_dst_drop(skb);\n+\n+\t\tgtp_push_header(skb, pctx);\n+\t\tudp_tunnel_xmit_skb(rt, sk, skb, saddr,\n+\t\t\t\t pctx->peer_addr_ip4.s_addr,\n+\t\t\t\t 0, ip4_dst_hoplimit(&rt->dst), 0,\n+\t\t\t\t pctx->gtp_port, pctx->gtp_port,\n+\t\t\t\t false, false);\n \n-\tskb_dst_drop(skb);\n+\t\tnetdev_dbg(dev, \"gtp -> IP src: %pI4 dst: %pI4\\n\",\n+\t\t\t &saddr, &pctx->peer_addr_ip4.s_addr);\n \n-\tgtp_push_header(skb, pctx);\n-\tudp_tunnel_xmit_skb(rt, sk, skb, saddr,\n-\t\t\t pctx->peer_addr_ip4.s_addr,\n-\t\t\t 0, ip4_dst_hoplimit(&rt->dst), 0,\n-\t\t\t pctx->gtp_port, pctx->gtp_port,\n-\t\t\t false, false);\n+#if IS_ENABLED(CONFIG_IPV6)\n+\t} else if (pctx->peer_af == AF_INET6) {\n+\t\tstruct in6_addr saddr = inet6_sk(sk)->saddr;\n+\t\tstruct dst_entry *dst;\n \n-\tnetdev_dbg(dev, \"gtp -> IP src: %pI4 dst: %pI4\\n\",\n-\t\t &saddr, &pctx->peer_addr_ip4.s_addr);\n+\t\tdst = ip6_tnl_get_route(dev, skb, sk, sk->sk_protocol,\n+\t\t\t\t\tsk->sk_bound_dev_if, 0,\n+\t\t\t\t\t0, &pctx->peer_addr_ip6, &saddr,\n+\t\t\t\t\tpctx->gtp_port, pctx->gtp_port,\n+\t\t\t\t\t&pctx->dst_cache, NULL);\n+\n+\t\tif (IS_ERR(dst)) {\n+\t\t\terr = PTR_ERR(dst);\n+\t\t\tgoto out_err;\n+\t\t}\n+\n+\t\tskb_dst_drop(skb);\n+\n+\t\tgtp_push_header(skb, pctx);\n+\t\tudp_tunnel6_xmit_skb(dst, sk, skb, dev,\n+\t\t\t\t &saddr, &pctx->peer_addr_ip6,\n+\t\t\t\t 0, ip6_dst_hoplimit(dst), 0,\n+\t\t\t\t pctx->gtp_port, pctx->gtp_port,\n+\t\t\t\t true);\n+\n+\t\tnetdev_dbg(dev, \"gtp -> IP src: %pI6 dst: %pI6\\n\",\n+\t\t\t &saddr, &pctx->peer_addr_ip6);\n+\n+#endif\n+\t}\n \n \treturn 0;\n \n@@ -652,7 +692,8 @@ static void gtp_link_setup(struct net_device *dev)\n \n \t/* Assume largest header, ie. GTPv0. */\n \tdev->needed_headroom\t= LL_MAX_HEADER +\n-\t\t\t\t sizeof(struct iphdr) +\n+\t\t\t\t max_t(int, sizeof(struct iphdr),\n+\t\t\t\t\tsizeof(struct ipv6hdr)) +\n \t\t\t\t sizeof(struct udphdr) +\n \t\t\t\t sizeof(struct gtp0_header);\n \n@@ -661,12 +702,15 @@ static void gtp_link_setup(struct net_device *dev)\n \n static int gtp_hashtable_new(struct gtp_dev *gtp, int hsize);\n static void gtp_hashtable_free(struct gtp_dev *gtp);\n-static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[]);\n+static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[],\n+\t\t\t bool is_ipv6);\n \n static int gtp_newlink(struct net *src_net, struct net_device *dev,\n \t\t struct nlattr *tb[], struct nlattr *data[],\n \t\t struct netlink_ext_ack *extack)\n {\n+\tunsigned int role = GTP_ROLE_GGSN;\n+\tbool is_ipv6 = false;\n \tstruct gtp_dev *gtp;\n \tstruct gtp_net *gn;\n \tint hashsize, err;\n@@ -674,9 +718,30 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev,\n \tif (!data[IFLA_GTP_FD0] && !data[IFLA_GTP_FD1])\n \t\treturn -EINVAL;\n \n+\tif (data[IFLA_GTP_ROLE]) {\n+\t\trole = nla_get_u32(data[IFLA_GTP_ROLE]);\n+\t\tif (role > GTP_ROLE_SGSN)\n+\t\t\treturn -EINVAL;\n+\t}\n+\n+\tif (data[IFLA_GTP_AF]) {\n+\t\tu16 af = nla_get_u16(data[IFLA_GTP_AF]);\n+\n+\t\tswitch (af) {\n+\t\tcase AF_INET:\n+\t\t\tis_ipv6 = false;\n+\t\t\tbreak;\n+\t\tcase AF_INET6:\n+\t\t\tis_ipv6 = true;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t}\n+\n \tgtp = netdev_priv(dev);\n \n-\terr = gtp_encap_enable(gtp, data);\n+\terr = gtp_encap_enable(gtp, data, is_ipv6);\n \tif (err < 0)\n \t\treturn err;\n \n@@ -695,6 +760,9 @@ static int gtp_newlink(struct net *src_net, struct net_device *dev,\n \t\tgoto out_hashtable;\n \t}\n \n+\tgtp->role = role;\n+\tgtp->is_ipv6 = is_ipv6;\n+\n \tgn = net_generic(dev_net(dev), gtp_net_id);\n \tlist_add_rcu(>p->list, &gn->gtp_dev_list);\n \n@@ -816,7 +884,8 @@ static void gtp_hashtable_free(struct gtp_dev *gtp)\n }\n \n static struct sock *gtp_encap_enable_socket(int fd, int type,\n-\t\t\t\t\t struct gtp_dev *gtp)\n+\t\t\t\t\t struct gtp_dev *gtp,\n+\t\t\t\t\t bool is_ipv6)\n {\n \tstruct udp_tunnel_sock_cfg tuncfg = {NULL};\n \tstruct socket *sock;\n@@ -837,6 +906,12 @@ static struct sock *gtp_encap_enable_socket(int fd, int type,\n \t\tgoto out_sock;\n \t}\n \n+\tif (sock->sk->sk_family != (is_ipv6 ? AF_INET6 : AF_INET)) {\n+\t\tpr_debug(\"socket fd=%d not right family\\n\", fd);\n+\t\tsk = ERR_PTR(-EINVAL);\n+\t\tgoto out_sock;\n+\t}\n+\n \tif (rcu_dereference_sk_user_data(sock->sk)) {\n \t\tsk = ERR_PTR(-EBUSY);\n \t\tgoto out_sock;\n@@ -869,16 +944,16 @@ static struct sock *gtp_encap_enable_socket(int fd, int type,\n \treturn sk;\n }\n \n-static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[])\n+static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[],\n+\t\t\t bool is_ipv6)\n {\n-\tstruct sock *sk1u = NULL;\n-\tstruct sock *sk0 = NULL;\n-\tunsigned int role = GTP_ROLE_GGSN;\n+\tstruct sock *sk0 = NULL, *sk1u = NULL;\n \n \tif (data[IFLA_GTP_FD0]) {\n \t\tu32 fd0 = nla_get_u32(data[IFLA_GTP_FD0]);\n \n-\t\tsk0 = gtp_encap_enable_socket(fd0, UDP_ENCAP_GTP0, gtp);\n+\t\tsk0 = gtp_encap_enable_socket(fd0, UDP_ENCAP_GTP0, gtp,\n+\t\t\t\t\t is_ipv6);\n \t\tif (IS_ERR(sk0))\n \t\t\treturn PTR_ERR(sk0);\n \t}\n@@ -886,7 +961,8 @@ static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[])\n \tif (data[IFLA_GTP_FD1]) {\n \t\tu32 fd1 = nla_get_u32(data[IFLA_GTP_FD1]);\n \n-\t\tsk1u = gtp_encap_enable_socket(fd1, UDP_ENCAP_GTP1U, gtp);\n+\t\tsk1u = gtp_encap_enable_socket(fd1, UDP_ENCAP_GTP1U, gtp,\n+\t\t\t\t\t is_ipv6);\n \t\tif (IS_ERR(sk1u)) {\n \t\t\tif (sk0)\n \t\t\t\tgtp_encap_disable_sock(sk0);\n@@ -894,15 +970,8 @@ static int gtp_encap_enable(struct gtp_dev *gtp, struct nlattr *data[])\n \t\t}\n \t}\n \n-\tif (data[IFLA_GTP_ROLE]) {\n-\t\trole = nla_get_u32(data[IFLA_GTP_ROLE]);\n-\t\tif (role > GTP_ROLE_SGSN)\n-\t\t\treturn -EINVAL;\n-\t}\n-\n \tgtp->sk0 = sk0;\n \tgtp->sk1u = sk1u;\n-\tgtp->role = role;\n \n \treturn 0;\n }\n@@ -938,8 +1007,16 @@ static void pdp_fill(struct pdp_ctx *pctx, struct genl_info *info)\n \t__be16 default_port = 0;\n \n \tpctx->gtp_version = nla_get_u32(info->attrs[GTPA_VERSION]);\n-\tpctx->peer_addr_ip4.s_addr =\n-\t\tnla_get_be32(info->attrs[GTPA_PEER_ADDRESS]);\n+\n+\tif (info->attrs[GTPA_PEER_ADDRESS]) {\n+\t\tpctx->peer_af = AF_INET;\n+\t\tpctx->peer_addr_ip4.s_addr =\n+\t\t\tnla_get_in_addr(info->attrs[GTPA_PEER_ADDRESS]);\n+\t} else if (info->attrs[GTPA_PEER6_ADDRESS]) {\n+\t\tpctx->peer_af = AF_INET6;\n+\t\tpctx->peer_addr_ip6 = nla_get_in6_addr(\n+\t\t\t\t\tinfo->attrs[GTPA_PEER6_ADDRESS]);\n+\t}\n \n \tswitch (pctx->gtp_version) {\n \tcase GTP_V0:\n@@ -1101,9 +1178,15 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info)\n \tint err;\n \n \tif (!info->attrs[GTPA_VERSION] ||\n-\t !info->attrs[GTPA_LINK] ||\n-\t !info->attrs[GTPA_PEER_ADDRESS])\n+\t !info->attrs[GTPA_LINK])\n+\t\treturn -EINVAL;\n+\n+\tif (!(!!info->attrs[GTPA_PEER_ADDRESS] ^\n+\t !!info->attrs[GTPA_PEER6_ADDRESS])) {\n+\t\t/* Either v4 or v6 peer address must be set */\n+\n \t\treturn -EINVAL;\n+\t}\n \n \tif (!(!!info->attrs[GTPA_MS_ADDRESS] ^\n \t !!info->attrs[GTPA_MS6_ADDRESS])) {\n@@ -1138,6 +1221,12 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info)\n \t\tgoto out_unlock;\n \t}\n \n+\tif ((info->attrs[GTPA_PEER_ADDRESS] && gtp->is_ipv6) ||\n+\t (info->attrs[GTPA_PEER6_ADDRESS] && !gtp->is_ipv6)) {\n+\t\terr = -EINVAL;\n+\t\tgoto out_unlock;\n+\t}\n+\n \tif (version == GTP_V0)\n \t\tsk = gtp->sk0;\n \telse if (version == GTP_V1)\n@@ -1244,9 +1333,28 @@ static int gtp_genl_fill_info(struct sk_buff *skb, u32 snd_portid, u32 snd_seq,\n \tif (genlh == NULL)\n \t\tgoto nlmsg_failure;\n \n-\tif (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version) ||\n-\t nla_put_be32(skb, GTPA_PEER_ADDRESS, pctx->peer_addr_ip4.s_addr))\n+\tif (nla_put_u32(skb, GTPA_VERSION, pctx->gtp_version))\n+\t\tgoto nla_put_failure;\n+\n+\tif (nla_put_u32(skb, GTPA_LINK, pctx->dev->ifindex))\n+\t\tgoto nla_put_failure;\n+\n+\tswitch (pctx->peer_af) {\n+\tcase AF_INET:\n+\t\tif (nla_put_be32(skb, GTPA_PEER_ADDRESS,\n+\t\t\t\t pctx->peer_addr_ip4.s_addr))\n+\t\t\tgoto nla_put_failure;\n+\n+\t\tbreak;\n+\tcase AF_INET6:\n+\t\tif (nla_put_in6_addr(skb, GTPA_PEER6_ADDRESS,\n+\t\t\t\t &pctx->peer_addr_ip6))\n+\t\t\tgoto nla_put_failure;\n+\n+\t\tbreak;\n+\tdefault:\n \t\tgoto nla_put_failure;\n+\t}\n \n \tswitch (pctx->ms_af) {\n \tcase AF_INET:\n@@ -1373,6 +1481,8 @@ static struct nla_policy gtp_genl_policy[GTPA_MAX + 1] = {\n \t[GTPA_VERSION]\t\t= { .type = NLA_U32, },\n \t[GTPA_TID]\t\t= { .type = NLA_U64, },\n \t[GTPA_PEER_ADDRESS]\t= { .type = NLA_U32, },\n+\t[GTPA_PEER6_ADDRESS]\t= { .len = FIELD_SIZEOF(struct ipv6hdr,\n+\t\t\t\t\t\t\tdaddr) },\n \t[GTPA_MS_ADDRESS]\t= { .type = NLA_U32, },\n \t[GTPA_MS6_ADDRESS]\t= { .len = FIELD_SIZEOF(struct ipv6hdr,\n \t\t\t\t\t\t\tdaddr) },\ndiff --git a/include/uapi/linux/gtp.h b/include/uapi/linux/gtp.h\nindex ae4e632c0360..8eec519fa754 100644\n--- a/include/uapi/linux/gtp.h\n+++ b/include/uapi/linux/gtp.h\n@@ -29,6 +29,7 @@ enum gtp_attrs {\n \tGTPA_PAD,\n \tGTPA_PORT,\n \tGTPA_MS6_ADDRESS,\n+\tGTPA_PEER6_ADDRESS,\n \t__GTPA_MAX,\n };\n #define GTPA_MAX (__GTPA_MAX + 1)\ndiff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h\nindex 8d062c58d5cb..81c26864abeb 100644\n--- a/include/uapi/linux/if_link.h\n+++ b/include/uapi/linux/if_link.h\n@@ -552,6 +552,9 @@ enum {\n \tIFLA_GTP_FD1,\n \tIFLA_GTP_PDP_HASHSIZE,\n \tIFLA_GTP_ROLE,\n+\tIFLA_GTP_AF,\n+\tIFLA_GTP_PORT0,\n+\tIFLA_GTP_PORT1,\n \t__IFLA_GTP_MAX,\n };\n #define IFLA_GTP_MAX (__IFLA_GTP_MAX - 1)\n", "prefixes": [ "net-next", "08/14" ] }