mii-tool: fix inverted advertising/link features
authorBen Hutchings <ben@decadent.org.uk>
Wed, 4 Jan 2012 21:26:48 +0000 (16:26 -0500)
committerMike Frysinger <vapier@gentoo.org>
Wed, 4 Jan 2012 21:28:42 +0000 (16:28 -0500)
On a system with a gigabit NIC attached to a 100mbit switch:
# mii-tool -v eth0
capabilities: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
link partner: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control

Clearly the last two fields are swapped, and reading the code supports
this hypothesis.

URL: https://bugs.gentoo.org/393107
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511395
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
mii-tool.c

index 39d2f3f..1d57526 100644 (file)
@@ -327,9 +327,9 @@ int show_basic_mii(int sock, int phy_id)
            printf("remote fault, ");
        printf((bmsr & MII_BMSR_LINK_VALID) ? "link ok" : "no link");
        printf("\n  capabilities:%s", media_list(bmsr >> 6, bmcr2, 0));
-       printf("\n  advertising: %s", media_list(advert, lpa2 >> 2, 0));
+       printf("\n  advertising: %s", media_list(advert, bmcr2, 0));
        if (lkpar & MII_AN_ABILITY_MASK)
-           printf("\n  link partner:%s", media_list(lkpar, bmcr2, 0));
+           printf("\n  link partner:%s", media_list(lkpar, lpa2 >> 2, 0));
        printf("\n");
     }
     fflush(stdout);