{"id":811335,"url":"http://patchwork.ozlabs.org/api/patches/811335/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20170908070018.4141-3-daniel.axtens@canonical.com/","project":{"id":15,"url":"http://patchwork.ozlabs.org/api/projects/15/?format=json","name":"Ubuntu Kernel","link_name":"ubuntu-kernel","list_id":"kernel-team.lists.ubuntu.com","list_email":"kernel-team@lists.ubuntu.com","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170908070018.4141-3-daniel.axtens@canonical.com>","list_archive_url":null,"date":"2017-09-08T07:00:13","name":"[SRU,Zesty,2/7] net: add dst_pending_confirm flag to skbuff","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e336e7b4c6c52e611781a7d179ee8cb077213dcc","submitter":{"id":71548,"url":"http://patchwork.ozlabs.org/api/people/71548/?format=json","name":"Daniel Axtens","email":"daniel.axtens@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20170908070018.4141-3-daniel.axtens@canonical.com/mbox/","series":[{"id":2111,"url":"http://patchwork.ozlabs.org/api/series/2111/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/list/?series=2111","date":"2017-09-08T07:00:11","name":"Fixes for LP#1715812","version":1,"mbox":"http://patchwork.ozlabs.org/series/2111/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811335/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811335/checks/","tags":{},"related":[],"headers":{"Return-Path":"<kernel-team-bounces@lists.ubuntu.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com\n\t(client-ip=91.189.94.19; helo=huckleberry.canonical.com;\n\tenvelope-from=kernel-team-bounces@lists.ubuntu.com;\n\treceiver=<UNKNOWN>)","Received":["from huckleberry.canonical.com (huckleberry.canonical.com\n\t[91.189.94.19])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpSrk3YJbz9s83;\n\tFri,  8 Sep 2017 17:00:38 +1000 (AEST)","from localhost ([127.0.0.1] helo=huckleberry.canonical.com)\n\tby huckleberry.canonical.com with esmtp (Exim 4.86_2)\n\t(envelope-from <kernel-team-bounces@lists.ubuntu.com>)\n\tid 1dqDHH-0000lb-PY; Fri, 08 Sep 2017 07:00:35 +0000","from youngberry.canonical.com ([91.189.89.112])\n\tby huckleberry.canonical.com with esmtps\n\t(TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.86_2) (envelope-from <daniel.axtens@canonical.com>)\n\tid 1dqDHG-0000k0-1I\n\tfor kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:00:34 +0000","from mail-pg0-f69.google.com ([74.125.83.69])\n\tby youngberry.canonical.com with esmtps\n\t(TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.76) (envelope-from <daniel.axtens@canonical.com>)\n\tid 1dqDHF-00039W-LD\n\tfor kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:00:33 +0000","by mail-pg0-f69.google.com with SMTP id t3so3617038pgt.7\n\tfor <kernel-team@lists.canonical.com>;\n\tFri, 08 Sep 2017 00:00:33 -0700 (PDT)","from localhost.localdomain (124-171-202-56.dyn.iinet.net.au.\n\t[124.171.202.56]) by smtp.gmail.com with ESMTPSA id\n\t125sm2138129pff.5.2017.09.08.00.00.30\n\tfor <kernel-team@lists.canonical.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 08 Sep 2017 00:00:31 -0700 (PDT)"],"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:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=9VHH5uOBld5EHRvZoMUWRANBWTZ6iqyYt7A1J3tw7j4=;\n\tb=JO/TiVSE9IHkMHi9N6IxR6eLUOeRbbO2CSEqEPWLhIVIpR6MHGZPfU/1gyIQigZj/L\n\tgzErNlE0RC8Q9FN/GN+72rqmgIUAM1WN/N1LCdudoZ+dZWeJq4ZKLGGA9UzcmrN7ezcJ\n\tRY55YTfcF6rY5UssruBwI2LKOMG0E25eLrosDUyjbKq3bJlaYVPAinWOFeScyzB055s7\n\tHYYAK63u/w/kG0JRaFtzVMn9Cq/+fhcrhLSJs0f/lfGXp9Ik5aa9w6TCLTIQviDHK9eO\n\taNlwGKluxd4NcS09PpdXrUxYb6yDDxZEfUfdTUi2dOWKtt9YfLtv/RgOkBs+rbgHNeqw\n\tRiYw==","X-Gm-Message-State":"AHPjjUhpz9hRcnlmDBZcKi16CFPv9Cm5t1ydAc1ewpqmokQA7jZ2HAkx\n\tKcyp7CU2L8D373QtTzbVr9p2C0TAnmz0wuVQ8H5ycOk2LosI7/63QIdwKYMQofpBjZ1NGhpcbRO\n\t3W7RswIPh0l4ggxkeutufnWsVg72nhChQfG1Dg00=","X-Received":["by 10.84.128.72 with SMTP id 66mr2325605pla.119.1504854032218;\n\tFri, 08 Sep 2017 00:00:32 -0700 (PDT)","by 10.84.128.72 with SMTP id 66mr2325593pla.119.1504854032015;\n\tFri, 08 Sep 2017 00:00:32 -0700 (PDT)"],"X-Google-Smtp-Source":"ADKCNb7tPJPNzPZYIlnllYPWBdCkL8dzP+7LTTcWTHKOv1yeyDY3bokZazAJQ/JMiWfCxRKJ3Pl1WA==","From":"Daniel Axtens <daniel.axtens@canonical.com>","To":"kernel-team@lists.canonical.com","Subject":"[SRU][Zesty][PATCH 2/7] net: add dst_pending_confirm flag to skbuff","Date":"Fri,  8 Sep 2017 17:00:13 +1000","Message-Id":"<20170908070018.4141-3-daniel.axtens@canonical.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170908070018.4141-1-daniel.axtens@canonical.com>","References":"<20170908070018.4141-1-daniel.axtens@canonical.com>","X-BeenThere":"kernel-team@lists.ubuntu.com","X-Mailman-Version":"2.1.20","Precedence":"list","List-Id":"Kernel team discussions <kernel-team.lists.ubuntu.com>","List-Unsubscribe":"<https://lists.ubuntu.com/mailman/options/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe>","List-Archive":"<https://lists.ubuntu.com/archives/kernel-team>","List-Post":"<mailto:kernel-team@lists.ubuntu.com>","List-Help":"<mailto:kernel-team-request@lists.ubuntu.com?subject=help>","List-Subscribe":"<https://lists.ubuntu.com/mailman/listinfo/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"kernel-team-bounces@lists.ubuntu.com","Sender":"\"kernel-team\" <kernel-team-bounces@lists.ubuntu.com>"},"content":"From: Julian Anastasov <ja@ssi.bg>\n\nBugLink: https://bugs.launchpad.net/bugs/1715812\n\nAdd new skbuff flag to allow protocols to confirm neighbour.\nWhen same struct dst_entry can be used for many different\nneighbours we can not use it for pending confirmations.\n\nAdd sock_confirm_neigh() helper to confirm the neighbour and\nuse it for IPv4, IPv6 and VRF before dst_neigh_output.\n\nSigned-off-by: Julian Anastasov <ja@ssi.bg>\nAcked-by: Eric Dumazet <edumazet@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>\n(cherry picked from commit 4ff0620354f2b39b9fe2a91c22c4de9d1fba0c8e)\nSigned-off-by: Daniel Axtens <daniel.axtens@canonical.com>\n---\n drivers/net/vrf.c      |  5 ++++-\n include/linux/skbuff.h | 12 ++++++++++++\n include/net/sock.h     | 14 ++++++++++++++\n net/ipv4/ip_output.c   |  5 ++++-\n net/ipv6/ip6_output.c  |  1 +\n 5 files changed, 35 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c\nindex f2fd52e71a5e..82232897c994 100644\n--- a/drivers/net/vrf.c\n+++ b/drivers/net/vrf.c\n@@ -380,6 +380,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,\n \tif (unlikely(!neigh))\n \t\tneigh = __neigh_create(&nd_tbl, nexthop, dst->dev, false);\n \tif (!IS_ERR(neigh)) {\n+\t\tsock_confirm_neigh(skb, neigh);\n \t\tret = dst_neigh_output(dst, neigh, skb);\n \t\trcu_read_unlock_bh();\n \t\treturn ret;\n@@ -578,8 +579,10 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *s\n \tneigh = __ipv4_neigh_lookup_noref(dev, nexthop);\n \tif (unlikely(!neigh))\n \t\tneigh = __neigh_create(&arp_tbl, &nexthop, dev, false);\n-\tif (!IS_ERR(neigh))\n+\tif (!IS_ERR(neigh)) {\n+\t\tsock_confirm_neigh(skb, neigh);\n \t\tret = dst_neigh_output(dst, neigh, skb);\n+\t}\n \n \trcu_read_unlock_bh();\n err:\ndiff --git a/include/linux/skbuff.h b/include/linux/skbuff.h\nindex a410715bbef8..ee060e8c6ff1 100644\n--- a/include/linux/skbuff.h\n+++ b/include/linux/skbuff.h\n@@ -610,6 +610,7 @@ static inline bool skb_mstamp_after(const struct skb_mstamp *t1,\n  *\t@wifi_acked_valid: wifi_acked was set\n  *\t@wifi_acked: whether frame was acked on wifi or not\n  *\t@no_fcs:  Request NIC to treat last 4 bytes as Ethernet FCS\n+ *\t@dst_pending_confirm: need to confirm neighbour\n   *\t@napi_id: id of the NAPI struct this skb came from\n  *\t@secmark: security marking\n  *\t@mark: Generic packet mark\n@@ -740,6 +741,7 @@ struct sk_buff {\n \t__u8\t\t\tcsum_level:2;\n \t__u8\t\t\tcsum_bad:1;\n \n+\t__u8\t\t\tdst_pending_confirm:1;\n #ifdef CONFIG_IPV6_NDISC_NODETYPE\n \t__u8\t\t\tndisc_nodetype:2;\n #endif\n@@ -3689,6 +3691,16 @@ static inline bool skb_rx_queue_recorded(const struct sk_buff *skb)\n \treturn skb->queue_mapping != 0;\n }\n \n+static inline void skb_set_dst_pending_confirm(struct sk_buff *skb, u32 val)\n+{\n+\tskb->dst_pending_confirm = val;\n+}\n+\n+static inline bool skb_get_dst_pending_confirm(const struct sk_buff *skb)\n+{\n+\treturn skb->dst_pending_confirm != 0;\n+}\n+\n static inline struct sec_path *skb_sec_path(struct sk_buff *skb)\n {\n #ifdef CONFIG_XFRM\ndiff --git a/include/net/sock.h b/include/net/sock.h\nindex 7e4ca83a6815..dfe020eea2ae 100644\n--- a/include/net/sock.h\n+++ b/include/net/sock.h\n@@ -1818,6 +1818,20 @@ static inline void sk_dst_confirm(struct sock *sk)\n \t\tsk->sk_dst_pending_confirm = 1;\n }\n \n+static inline void sock_confirm_neigh(struct sk_buff *skb, struct neighbour *n)\n+{\n+\tif (skb_get_dst_pending_confirm(skb)) {\n+\t\tstruct sock *sk = skb->sk;\n+\t\tunsigned long now = jiffies;\n+\n+\t\t/* avoid dirtying neighbour */\n+\t\tif (n->confirmed != now)\n+\t\t\tn->confirmed = now;\n+\t\tif (sk && sk->sk_dst_pending_confirm)\n+\t\t\tsk->sk_dst_pending_confirm = 0;\n+\t}\n+}\n+\n bool sk_mc_loop(struct sock *sk);\n \n static inline bool sk_can_gso(const struct sock *sk)\ndiff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c\nindex 49e9b2bc6e33..8c85cad2b2af 100644\n--- a/net/ipv4/ip_output.c\n+++ b/net/ipv4/ip_output.c\n@@ -222,7 +222,10 @@ static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *s\n \tif (unlikely(!neigh))\n \t\tneigh = __neigh_create(&arp_tbl, &nexthop, dev, false);\n \tif (!IS_ERR(neigh)) {\n-\t\tint res = dst_neigh_output(dst, neigh, skb);\n+\t\tint res;\n+\n+\t\tsock_confirm_neigh(skb, neigh);\n+\t\tres = dst_neigh_output(dst, neigh, skb);\n \n \t\trcu_read_unlock_bh();\n \t\treturn res;\ndiff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c\nindex b65ce893f1cb..7ceac3b8694a 100644\n--- a/net/ipv6/ip6_output.c\n+++ b/net/ipv6/ip6_output.c\n@@ -119,6 +119,7 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *\n \tif (unlikely(!neigh))\n \t\tneigh = __neigh_create(&nd_tbl, nexthop, dst->dev, false);\n \tif (!IS_ERR(neigh)) {\n+\t\tsock_confirm_neigh(skb, neigh);\n \t\tret = dst_neigh_output(dst, neigh, skb);\n \t\trcu_read_unlock_bh();\n \t\treturn ret;\n","prefixes":["SRU","Zesty","2/7"]}