lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250729110724.GA15902@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
Date: Tue, 29 Jul 2025 04:07:24 -0700
From: Erni Sri Satya Vennela <ernis@...ux.microsoft.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: dsahern@...il.com, netdev@...r.kernel.org, haiyangz@...rosoft.com,
	shradhagupta@...ux.microsoft.com, ssengar@...rosoft.com,
	ernis@...rosoft.com
Subject: Re: [PATCH iproute2-next] iproute2: Add 'netshaper' command to 'ip
 link' for netdev shaping

On Mon, Jul 28, 2025 at 11:13:03AM -0700, Stephen Hemminger wrote:
> On Mon, 28 Jul 2025 02:14:59 -0700
> Erni Sri Satya Vennela <ernis@...ux.microsoft.com> wrote:
> 
> > +
> > +static void print_netshaper_attrs(struct nlmsghdr *answer)
> > +{
> > +	struct genlmsghdr *ghdr = NLMSG_DATA(answer);
> > +	int len = answer->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
> > +	struct rtattr *tb[NET_SHAPER_A_MAX + 1] = {};
> > +	__u32 speed_bps, speed_mbps;
> > +	int ifindex;
> > +
> > +	parse_rtattr(tb, NET_SHAPER_A_MAX, (struct rtattr *)((char *)ghdr + GENL_HDRLEN), len);
> > +
> > +	for (int i = 1; i <= NET_SHAPER_A_MAX; ++i) {
> > +		if (!tb[i])
> > +			continue;
> > +		switch (i) {
> > +		case NET_SHAPER_A_BW_MAX:
> > +		speed_bps = rta_getattr_u32(tb[i]);
> > +		speed_mbps = (speed_bps / 1000000);
> > +		print_uint(PRINT_ANY, "speed", "Current speed (Mbps): %u\n", speed_mbps);
> > +		break;
> > +		case NET_SHAPER_A_IFINDEX:
> > +		ifindex = rta_getattr_u32(tb[i]);
> > +		print_string(PRINT_ANY, "dev", "Device Name: %s\n", ll_index_to_name(ifindex));
> 
> The display in print is supposed to correlate with command line args.
> Use color for devices if possible.
Thankyou for the pointers Stephen. I will make sure to integrate this in
the next version.
> 
> > +		break;
> > +		default:
> > +		break;
> > +		}
> > +	}
> > +}
> 
> Indentation is a mess.
> 
> Iproute2 uses kernel coding style.
> Suggest using a tool like clang-format to fix.
Sure, I'll use this tool to correct issues with indentation.
Thankyou.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ