From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f49.google.com ([209.85.160.49]:40454 "EHLO mail-pl0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750782AbeCFQxn (ORCPT ); Tue, 6 Mar 2018 11:53:43 -0500 Received: by mail-pl0-f49.google.com with SMTP id i6-v6so12160349plt.7 for ; Tue, 06 Mar 2018 08:53:43 -0800 (PST) Subject: Re: [PATCH iproute2-next 4/7] ip: add json support to ntable To: Stephen Hemminger Cc: netdev@vger.kernel.org, Stephen Hemminger References: <20180306030501.1289-1-stephen@networkplumber.org> <20180306030501.1289-5-stephen@networkplumber.org> From: David Ahern Message-ID: Date: Tue, 6 Mar 2018 09:53:41 -0700 MIME-Version: 1.0 In-Reply-To: <20180306030501.1289-5-stephen@networkplumber.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 3/5/18 8:04 PM, Stephen Hemminger wrote: > @@ -338,274 +339,308 @@ static const char *ntable_strtime_delta(__u32 msec) > return str; > } > > -static int print_ntable(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) > +static void print_ndtconfig(const struct ndt_config *ndtc) > { > - FILE *fp = (FILE *)arg; > - struct ndtmsg *ndtm = NLMSG_DATA(n); > - int len = n->nlmsg_len; > - struct rtattr *tb[NDTA_MAX+1]; > - struct rtattr *tpb[NDTPA_MAX+1]; > - int ret; > > - if (n->nlmsg_type != RTM_NEWNEIGHTBL) { > - fprintf(stderr, "Not NEIGHTBL: %08x %08x %08x\n", > - n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags); > - return 0; > - } > - len -= NLMSG_LENGTH(sizeof(*ndtm)); > - if (len < 0) { > - fprintf(stderr, "BUG: wrong nlmsg len %d\n", len); > - return -1; > - } > + print_uint(PRINT_ANY, "key_length", > + " config key_len %u ", ndtc->ndtc_key_len); > + print_uint(PRINT_ANY, "entry_size", > + "entry_size %u ", ndtc->ndtc_entry_size); this one has a number of places where the second line is misaligned.