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]
Date:	Thu, 30 Apr 2009 13:37:43 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Jeff Garzik <jgarzik@...ox.com>
Cc:	netdev <netdev@...r.kernel.org>
Subject: [PATCH 4/5] ethtool: Report link partner advertising

Signed-off-by: Ben Hutchings <bhutchings@...arflare.com>
---
 ethtool.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/ethtool.c b/ethtool.c
index 08165eb..0d188af 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -839,12 +839,13 @@ static void dump_supported(struct ethtool_cmd *ep)
 		fprintf(stdout, "No\n");
 }
 
-static void dump_advertised(struct ethtool_cmd *ep)
+static void dump_advertised(struct ethtool_cmd *ep,
+			    const char *prefix, u_int32_t mask)
 {
-	u_int32_t mask = ep->advertising;
+	int indent = strlen(prefix) + 14;
 	int did1;
 
-	fprintf(stdout, "	Advertised link modes:  ");
+	fprintf(stdout, "	%s link modes:  ", prefix);
 	did1 = 0;
 	if (mask & ADVERTISED_10baseT_Half) {
 		did1++; fprintf(stdout, "10baseT/Half ");
@@ -854,7 +855,7 @@ static void dump_advertised(struct ethtool_cmd *ep)
 	}
 	if (did1 && (mask & (ADVERTISED_100baseT_Half|ADVERTISED_100baseT_Full))) {
 		fprintf(stdout, "\n");
-		fprintf(stdout, "	                        ");
+		fprintf(stdout, "	%*s", indent, "");
 	}
 	if (mask & ADVERTISED_100baseT_Half) {
 		did1++; fprintf(stdout, "100baseT/Half ");
@@ -864,7 +865,7 @@ static void dump_advertised(struct ethtool_cmd *ep)
 	}
 	if (did1 && (mask & (ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full))) {
 		fprintf(stdout, "\n");
-		fprintf(stdout, "	                        ");
+		fprintf(stdout, "	%*s", indent, "");
 	}
 	if (mask & ADVERTISED_1000baseT_Half) {
 		did1++; fprintf(stdout, "1000baseT/Half ");
@@ -874,14 +875,14 @@ static void dump_advertised(struct ethtool_cmd *ep)
 	}
 	if (did1 && (mask & ADVERTISED_2500baseX_Full)) {
 		fprintf(stdout, "\n");
-		fprintf(stdout, "	                        ");
+		fprintf(stdout, "	%*s", indent, "");
 	}
 	if (mask & ADVERTISED_2500baseX_Full) {
 		did1++; fprintf(stdout, "2500baseX/Full ");
 	}
 	if (did1 && (mask & ADVERTISED_10000baseT_Full)) {
 		fprintf(stdout, "\n");
-		fprintf(stdout, "	                        ");
+		fprintf(stdout, "	%*s", indent, "");
 	}
 	if (mask & ADVERTISED_10000baseT_Full) {
 		did1++; fprintf(stdout, "10000baseT/Full ");
@@ -890,7 +891,7 @@ static void dump_advertised(struct ethtool_cmd *ep)
 		 fprintf(stdout, "Not reported");
 	fprintf(stdout, "\n");
 
-	fprintf(stdout, "	Advertised auto-negotiation: ");
+	fprintf(stdout, "	%s auto-negotiation: ", prefix);
 	if (mask & ADVERTISED_Autoneg)
 		fprintf(stdout, "Yes\n");
 	else
@@ -902,7 +903,8 @@ static int dump_ecmd(struct ethtool_cmd *ep)
 	u32 speed;
 
 	dump_supported(ep);
-	dump_advertised(ep);
+	dump_advertised(ep, "Advertised", ep->advertising);
+	dump_advertised(ep, "Link partner advertised", ep->lp_advertising);
 
 	fprintf(stdout, "	Speed: ");
 	speed = ethtool_cmd_speed(ep);

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ