Subject: Re: [PATCH iproute2-next 06/11] ipstats: Add a group "link"

From: Ido Schimmel <[email-masked]>
Date: Mon, 2 May 2022 09:19:12 +0300

On Sun, May 01, 2022 at 09:56:16PM -0700, David Ahern wrote:
> On 5/1/22 8:52 AM, Ido Schimmel wrote:
> > 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
> > 
> 
> ...
> 
> > 
> > Note the difference in size of IFLA_STATS_LINK_64 which carries struct
> > rtnl_link_stats64: 196 bytes vs. 204 bytes
> > 
> > The 8 byte difference is most likely from the addition of
> > rx_otherhost_dropped at the end:
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=794c24e9921f32ded4422833a990ccf11dc3c00e
> > 
> > I guess it worked for me because I didn't have this member in my copy of
> > the uAPI file, but it's now in iproute2-next:
> > 
> > https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=bba95837524d09ee2f0efdf6350b83a985f4b2f8
> > 
> > I was under the impression that such a size increase in a uAPI struct is
> > forbidden, which is why we usually avoid passing structs over netlink.
> 
> extending structs at the end is typically allowed.

In this case, the iproute2 check needs to be modified as new iproute2
should work with old kernels.

> The ABI breakage is when an entry is added in the middle.

Sure, that's well understood.

Thanks!

> 
> 
> > 
> >> +		return -EINVAL;
> >> +	}
> >> +
> >> +	open_json_object("stats64");
> >> +	print_stats64(stdout, stats, NULL, NULL);
> >> +	close_json_object();
> >> +	return 0;
> >> +}
>