From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1167024AbdDXIn2 (ORCPT ); Mon, 24 Apr 2017 04:43:28 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34057 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1166960AbdDXInN (ORCPT ); Mon, 24 Apr 2017 04:43:13 -0400 Date: Mon, 24 Apr 2017 10:43:10 +0200 From: Jiri Pirko To: Jiri Kosina Cc: "David S. Miller" , Stephen Hemminger , Eric Dumazet , Jamal Hadi Salim , Phil Sutter , Cong Wang , Daniel Borkmann , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] iproute2: add support for invisible qdisc dumping Message-ID: <20170424084310.GB4126@nanopsycho.orion> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wed, Mar 08, 2017 at 01:04:42PM CET, jikos@kernel.org wrote: >From: Jiri Kosina > >Support the new TCA_DUMP_INVISIBLE netlink attribute that allows asking >kernel to perform 'full qdisc dump', as for historical reasons some of the >default qdiscs are being hidden by the kernel. > >The command syntax is being extended by voluntary 'invisible' argument to >'tc qdisc show'. > >Signed-off-by: Jiri Kosina >--- [...] >@@ -325,7 +328,25 @@ static int tc_qdisc_list(int argc, char **argv) > filter_ifindex = t.tcm_ifindex; > } > >- if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) { >+ if (dump_invisible) { >+ struct { >+ struct nlmsghdr n; >+ struct tcmsg t; >+ char buf[256]; >+ } req = { >+ .n.nlmsg_type = RTM_GETQDISC, >+ .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)), >+ }; >+ >+ req.t.tcm_family = AF_UNSPEC; >+ >+ addattr(&req.n, 256, TCA_DUMP_INVISIBLE); >+ if (rtnl_dump_request_n(&rth, &req.n) < 0) { Jirko, you ignore the values that were previously set in "t". I think that you can change this to do rtnl_dump_request_n always and simplify the code a bit. >+ perror("Cannot send dump request"); >+ return 1; >+ } >+ >+ } else if (rtnl_dump_request(&rth, RTM_GETQDISC, &t, sizeof(t)) < 0) { > perror("Cannot send dump request"); > return 1; > } >-- >Jiri Kosina >SUSE Labs >