{"id":811343,"url":"http://patchwork.ozlabs.org/api/patches/811343/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20170908070142.4440-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":"<20170908070142.4440-3-daniel.axtens@canonical.com>","list_archive_url":null,"date":"2017-09-08T07:01:37","name":"[SRU,Xenial,2/7] net: add dst_pending_confirm flag to skbuff","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"cd6fd532f436fc822ad1d756563f0a689194edba","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/20170908070142.4440-3-daniel.axtens@canonical.com/mbox/","series":[{"id":2112,"url":"http://patchwork.ozlabs.org/api/series/2112/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/list/?series=2112","date":"2017-09-08T07:01:35","name":"Fixes for LP#1715812","version":1,"mbox":"http://patchwork.ozlabs.org/series/2112/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/811343/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/811343/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 3xpStH3VWpz9s83;\n\tFri,  8 Sep 2017 17:01:59 +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 1dqDIa-0001Cz-N5; Fri, 08 Sep 2017 07:01:56 +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 1dqDIZ-0001Bx-EM\n\tfor kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:01:55 +0000","from mail-pf0-f200.google.com ([209.85.192.200])\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 1dqDIZ-0003DP-2m\n\tfor kernel-team@lists.canonical.com; Fri, 08 Sep 2017 07:01:55 +0000","by mail-pf0-f200.google.com with SMTP id q76so3475373pfq.5\n\tfor <kernel-team@lists.canonical.com>;\n\tFri, 08 Sep 2017 00:01:55 -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\th1sm2255518pfg.153.2017.09.08.00.01.51\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:01:52 -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=jOIBN52scmRXN7t2ddW/brHa0JT3zbM8FjS6bpHQxCM=;\n\tb=rRCalv15OX4sh2quGiugeZ1RKrs/fZmGGb376X4THbISCjpprmVgaCLJSlLY/eKzVe\n\tPRQ/WyFbTyfTwuJ4ggmZLSrEgS2OJlITRHnSc8FPZcXoY3SBDJ8DvUa6J0y5acrSGxUP\n\t7d0BqYXs+noSxZT/G8q55d2l0sSjppT4v3xkyFFHyVFX1dyceeestFl0d09aXseEYV5A\n\t6QGQ/T3WfzFwp9VAvy6jQJgtHh7rTwwO+lPrgZmSDIPhFNzqstergJ+D1JlVCt+4L92B\n\tj50Qz5ZnuKEql5JaDJUh2HOyXP87bFgf0AhHpzOpHwx1nDyTkvP4QAbPtjC4vIGH4fLC\n\tlTVQ==","X-Gm-Message-State":"AHPjjUh93IS5srUkDc7+64x3I9CV2ohoU0FWt92j6dmeloZSvZMqbmGs\n\tCgxF6JpH+UE+7ODwJeNcN1FudTp8cebx4jJHWaYrOP14B9EcC7UPrpRhHv5Q1pnrLuBNxcHV9bO\n\tT5bBzrA/gDr0rAMRye3qqejIgzC88Y1xPAUs/R20=","X-Received":["by 10.84.232.76 with SMTP id f12mr2235940pln.297.1504854113691; \n\tFri, 08 Sep 2017 00:01:53 -0700 (PDT)","by 10.84.232.76 with SMTP id f12mr2235932pln.297.1504854113505; \n\tFri, 08 Sep 2017 00:01:53 -0700 (PDT)"],"X-Google-Smtp-Source":"ADKCNb6h6gj/6eSHgoqcMmFGvhfj+ZN2LimgfE6/6LHmy96Pe+yAvw5mi3dUVJn7OQgdN/oLu8XaFg==","From":"Daniel Axtens <daniel.axtens@canonical.com>","To":"kernel-team@lists.canonical.com","Subject":"[SRU][Xenial][PATCH 2/7] net: add dst_pending_confirm flag to skbuff","Date":"Fri,  8 Sep 2017 17:01:37 +1000","Message-Id":"<20170908070142.4440-3-daniel.axtens@canonical.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170908070142.4440-1-daniel.axtens@canonical.com>","References":"<20170908070142.4440-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 ac945f8781ac..ff4adfe207a1 100644\n--- a/drivers/net/vrf.c\n+++ b/drivers/net/vrf.c\n@@ -424,6 +424,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@@ -550,8 +551,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 bbec150bd0d8..d7383cdb105e 100644\n--- a/include/linux/skbuff.h\n+++ b/include/linux/skbuff.h\n@@ -522,6 +522,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@offload_fwd_mark: fwding offload mark\n@@ -636,6 +637,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@@ -3495,6 +3497,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 08d2bb9e66ee..5650a7a99b4e 100644\n--- a/include/net/sock.h\n+++ b/include/net/sock.h\n@@ -1804,6 +1804,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 22e6ded344c1..17030a6bed20 100644\n--- a/net/ipv4/ip_output.c\n+++ b/net/ipv4/ip_output.c\n@@ -210,7 +210,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 4a4840cda6b8..f3d5b42584e6 100644\n--- a/net/ipv6/ip6_output.c\n+++ b/net/ipv6/ip6_output.c\n@@ -110,6 +110,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","Xenial","2/7"]}