From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4479C433F5 for ; Sun, 1 May 2022 14:52:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347797AbiEAOzg (ORCPT ); Sun, 1 May 2022 10:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232359AbiEAOzf (ORCPT ); Sun, 1 May 2022 10:55:35 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6A805714B for ; Sun, 1 May 2022 07:52:10 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BDF5F5C0084; Sun, 1 May 2022 10:52:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 01 May 2022 10:52:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1651416727; x= 1651503127; bh=ClOx8nKOAFevHapJnyTFZzSQZ1+WPiww8zy8vbVGIn8=; b=i vk2o+2bbMdNlsHoTLDek1q+y9lUjGpyUOYBwO6ytinUpDd6HQoAEc8nDJr4THs1p LPikNdScmfPYAzH3xYG3caJsKLsAFZiBUzXU3z4xXlijNbeFO8WnBfDMBF8SR/+p AuRToEvATGkS24qOX+Glu+Sw09isieaWGO4AoncSOjsQjKKS5xiHgKuITKtHlQBd xYOAUIDBneY7pp/NprjRw+Zmb7+1GTOWPE4Afw82OMnx2VuU8skvfn9bReB/gjIZ eHEj11d+HfBdXSw7RDie8OKfOdMgmjSIqC8lIqLtFtBOD4oKLBGYX9/QCQNXMxjy tdEwkgsIyDAvQYZKFTH7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefgdekudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpeehhfdtjedviefffeduuddvffegteeiieeguefgudffvdfftdefheeijedthfej keenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 1 May 2022 10:52:06 -0400 (EDT) Date: Sun, 1 May 2022 17:52:03 +0300 From: Ido Schimmel To: Petr Machata Cc: netdev@vger.kernel.org, David Ahern , Stephen Hemminger , Ido Schimmel Subject: Re: [PATCH iproute2-next 06/11] ipstats: Add a group "link" Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Apr 22, 2022 at 10:30:55AM +0200, Petr Machata wrote: > +#define IPSTATS_RTA_PAYLOAD(TYPE, AT) \ > + ({ \ > + const struct rtattr *__at = (AT); \ > + TYPE *__ret = NULL; \ > + \ > + if (__at != NULL && \ > + __at->rta_len - RTA_LENGTH(0) >= sizeof(TYPE)) \ > + __ret = RTA_DATA(__at); \ > + __ret; \ > + }) > + > +static int ipstats_show_64(struct ipstats_stat_show_attrs *attrs, > + unsigned int group, unsigned int subgroup) > +{ > + struct rtnl_link_stats64 *stats; > + const struct rtattr *at; > + int err; > + > + at = ipstats_stat_show_get_attr(attrs, group, subgroup, &err); > + if (at == NULL) > + return err; > + > + stats = IPSTATS_RTA_PAYLOAD(struct rtnl_link_stats64, at); > + if (stats == NULL) { > + fprintf(stderr, "Error: attribute payload too short"); When I tested this on 5.15 / 5.16 everything was fine, but now I get: $ ip stats show dev lo group link 1: lo: group link Error: attribute payload too short Payload on 5.16: recvmsg(3, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=12, msg_iov=[{iov_base=[{nlmsg_len=224, nlmsg_type=RTM_NEWSTATS, nlmsg_flags=0, nlmsg_seq=1651407379, nlmsg_pid=330213}, {family=AF_UNSPEC, ifindex=if_nametoindex("lo"), filter_mask=1< + return -EINVAL; > + } > + > + open_json_object("stats64"); > + print_stats64(stdout, stats, NULL, NULL); > + close_json_object(); > + return 0; > +}