{"id":817331,"url":"http://patchwork.ozlabs.org/api/patches/817331/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170922061008.14723-5-fw@strlen.de/","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":"<20170922061008.14723-5-fw@strlen.de>","list_archive_url":null,"date":"2017-09-22T06:10:06","name":"[net-next,v2,4/6] rtnetlink: add helper to dump ifalias","commit_ref":null,"pull_url":null,"state":"superseded","archived":true,"hash":"15ff9d05f2ad5661696eefcbfc3daec171b90142","submitter":{"id":1025,"url":"http://patchwork.ozlabs.org/api/people/1025/?format=json","name":"Florian Westphal","email":"fw@strlen.de"},"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/20170922061008.14723-5-fw@strlen.de/mbox/","series":[{"id":4543,"url":"http://patchwork.ozlabs.org/api/series/4543/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4543","date":"2017-09-22T06:10:02","name":"rtnetlink: preparation patches for further rtnl lock pushdown/removal","version":2,"mbox":"http://patchwork.ozlabs.org/series/4543/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817331/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817331/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>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xz3411sy2z9sNr\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 22 Sep 2017 16:10:09 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751891AbdIVGKG (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 02:10:06 -0400","from Chamillionaire.breakpoint.cc ([146.0.238.67]:41596 \"EHLO\n\tChamillionaire.breakpoint.cc\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1751795AbdIVGKF (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 22 Sep 2017 02:10:05 -0400","from fw by Chamillionaire.breakpoint.cc with local (Exim 4.84_2)\n\t(envelope-from <fw@breakpoint.cc>)\n\tid 1dvH6p-0003a5-HG; Fri, 22 Sep 2017 08:06:43 +0200"],"From":"Florian Westphal <fw@strlen.de>","To":"<netdev@vger.kernel.org>","Cc":"Florian Westphal <fw@strlen.de>","Subject":"[PATCH net-next v2 4/6] rtnetlink: add helper to dump ifalias","Date":"Fri, 22 Sep 2017 08:10:06 +0200","Message-Id":"<20170922061008.14723-5-fw@strlen.de>","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170922061008.14723-1-fw@strlen.de>","References":"<20170922061008.14723-1-fw@strlen.de>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"ifalias is currently protected by rtnl mutex, add assertion\nas a reminder.\n\nSigned-off-by: Florian Westphal <fw@strlen.de>\n---\n net/core/rtnetlink.c | 13 +++++++++++--\n 1 file changed, 11 insertions(+), 2 deletions(-)","diff":"diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c\nindex ad3f27da37a8..42ff582a010e 100644\n--- a/net/core/rtnetlink.c\n+++ b/net/core/rtnetlink.c\n@@ -1345,6 +1345,16 @@ static int nla_put_qdisc(struct sk_buff *skb, struct net_device *dev)\n \treturn ret;\n }\n \n+static noinline int nla_put_ifalias(struct sk_buff *skb, struct net_device *dev)\n+{\n+\tASSERT_RTNL();\n+\n+\tif (dev->ifalias)\n+\t\treturn nla_put_string(skb, IFLA_IFALIAS, dev->ifalias);\n+\n+\treturn 0;\n+}\n+\n static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,\n \t\t\t    int type, u32 pid, u32 seq, u32 change,\n \t\t\t    unsigned int flags, u32 ext_filter_mask,\n@@ -1386,8 +1396,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,\n \t    put_master_ifindex(skb, dev) ||\n \t    nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) ||\n \t    nla_put_qdisc(skb, dev) ||\n-\t    (dev->ifalias &&\n-\t     nla_put_string(skb, IFLA_IFALIAS, dev->ifalias)) ||\n+\t    nla_put_ifalias(skb, dev) ||\n \t    nla_put_u32(skb, IFLA_CARRIER_CHANGES,\n \t\t\tatomic_read(&dev->carrier_changes)) ||\n \t    nla_put_u8(skb, IFLA_PROTO_DOWN, dev->proto_down))\n","prefixes":["net-next","v2","4/6"]}