From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH net-next 4/4] netns: enable to dump full nsid translation table Date: Wed, 21 Nov 2018 14:08:46 -0700 Message-ID: <25aeca82-bd0e-5fc6-9fc9-a022d255e4fd@gmail.com> References: <20181121110124.5501-1-nicolas.dichtel@6wind.com> <20181121110124.5501-5-nicolas.dichtel@6wind.com> <3a7133b9-858c-5c6c-8402-323a07d8e875@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org To: nicolas.dichtel@6wind.com, davem@davemloft.net Return-path: Received: from mail-pl1-f193.google.com ([209.85.214.193]:47088 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732609AbeKVHot (ORCPT ); Thu, 22 Nov 2018 02:44:49 -0500 Received: by mail-pl1-f193.google.com with SMTP id t13so7169321ply.13 for ; Wed, 21 Nov 2018 13:08:49 -0800 (PST) In-Reply-To: <3a7133b9-858c-5c6c-8402-323a07d8e875@6wind.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/21/18 2:01 PM, Nicolas Dichtel wrote: > Le 21/11/2018 à 19:09, David Ahern a écrit : >> On 11/21/18 4:01 AM, Nicolas Dichtel wrote: >>> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c >>> index 92730905886c..fc568cd0b560 100644 >>> --- a/net/core/net_namespace.c >>> +++ b/net/core/net_namespace.c >>> @@ -740,7 +740,7 @@ static int rtnl_net_get_size(void) >>> } >>> >>> static int rtnl_net_fill(struct sk_buff *skb, u32 portid, u32 seq, int flags, >>> - int cmd, int nsid) >>> + int cmd, int nsid, bool add_ref, int ref_nsid) >>> { >>> struct nlmsghdr *nlh; >>> struct rtgenmsg *rth; >>> @@ -755,6 +755,9 @@ static int rtnl_net_fill(struct sk_buff *skb, u32 portid, u32 seq, int flags, >>> if (nla_put_s32(skb, NETNSA_NSID, nsid)) >>> goto nla_put_failure; >>> >>> + if (add_ref && nla_put_s32(skb, NETNSA_CURRENT_NSID, ref_nsid)) >>> + goto nla_put_failure; >> >> Why not use ref_nsid >= 0 and drop the add_ref argument? > Because ref_nsid can be -1 (NETNSA_NSID_NOT_ASSIGNED) and I didn't want to add > another magic, I think it's clearer with an explicit bool. > it pushes the input args to 8.