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: <20250728111303.301f61f2@hermes.local>
Date: Mon, 28 Jul 2025 11:13:03 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Erni Sri Satya Vennela <ernis@...ux.microsoft.com>
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, 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.

> +		break;
> +		default:
> +		break;
> +		}
> +	}
> +}

Indentation is a mess.

Iproute2 uses kernel coding style.
Suggest using a tool like clang-format to fix.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ