Debian Bug report logs - #549397
mii-tool decodes MII vendor ids wrongly

version graph

Package: net-tools; Maintainer for net-tools is net-tools Team <team+net-tools@tracker.debian.org>; Source for net-tools is src:net-tools (PTS, buildd, popcon).

Reported by: Ben Hutchings <ben@decadent.org.uk>

Date: Sat, 3 Oct 2009 00:21:01 UTC

Severity: normal

Tags: patch

Found in version net-tools/1.60-23

Fixed in version net-tools/1.60+git20181103.0eebece-1

Done: Utkarsh Gupta <utkarsh@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, net-tools Team <pkg-net-tools-maintainers@lists.alioth.debian.org>:
Bug#549397; Package net-tools. (Sat, 03 Oct 2009 00:21:04 GMT) (full text, mbox, link).


Acknowledgement sent to Ben Hutchings <ben@decadent.org.uk>:
New Bug report received and forwarded. Copy sent to net-tools Team <pkg-net-tools-maintainers@lists.alioth.debian.org>. (Sat, 03 Oct 2009 00:21:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Ben Hutchings <ben@decadent.org.uk>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: mii-tool decodes MII vendor ids wrongly
Date: Sat, 03 Oct 2009 01:19:22 +0100
Package: net-tools
Version: 1.60-23
Severity: normal
Tags: patch

The MII specification (IEEE 802.3 clause 22) specifies the PHY id
registers to hold the vendor id (OUI) in reverse bit order.  Many PHYs
have the bytes in reverse order but the bits in normal order, and this
is what mii-tool expects.  However, recent PHYs from at least AMCC,
Broadcom and Solarflare use the specified bit order and mii-tool
should follow this.

This patch changes mii-tool to decode the OUI according to both
interpretations.

--- net-tools-1.60.orig/mii-tool.c
+++ net-tools-1.60/mii-tool.c
@@ -224,6 +224,14 @@
     return buf;
 }
 
+static unsigned char bitreverse_byte(unsigned char byte)
+{
+    byte = (byte << 4) | (byte >> 4);
+    byte = (byte & 0x33) << 2 | (byte & 0xcc) >> 2;
+    byte = (byte & 0x55) << 1 | (byte & 0xaa) >> 1;
+    return byte;
+}
+
 int show_basic_mii(int sock, int phy_id)
 {
     char buf[100];
@@ -297,11 +305,31 @@
 		break;
 	if (i < NMII)
 	    printf("%s rev %d\n", mii_id[i].name, mii_val[3]&0x0f);
-	else
-	    printf("vendor %02x:%02x:%02x, model %d rev %d\n",
+	else {
+	    /* Each OUI consists of 24 bits a-z of which a and b are
+	     * always assigned as zero.  The bit assignments in these
+	     * registers are specified as:
+	     *     2.15-0   c-r
+	     *     3.15-10  s-x
+	     * This is the opposite of the bit order within each byte
+	     * for the written representation specified in section
+	     * 9.5.2 of IEEE 802-2001.  However, some vendors mirror
+	     * the written representation, using the bit assignments:
+	     *     2.15-10  f-a (?)
+	     *     2.9-2    p-i
+	     *     2.1-0    x-w
+	     *     3.15-10  v-q
+	     * Therefore we decode the registers under both
+	     * interpretations.
+	     */
+	    printf("vendor %02x:%02x:%02x or %02x:%02x:%02x, model %d rev %d\n",
+		   bitreverse_byte(mii_val[2]>>10),
+		   bitreverse_byte(mii_val[2]>>2),
+		   bitreverse_byte((mii_val[2]<<6)|(mii_val[3]>>10)),
 		   mii_val[2]>>10, (mii_val[2]>>2)&0xff,
 		   ((mii_val[2]<<6)|(mii_val[3]>>10))&0xff,
 		   (mii_val[3]>>4)&0x3f, mii_val[3]&0x0f);
+	}
 	printf("  basic mode:   ");
 	if (bmcr & MII_BMCR_RESET)
 	    printf("software reset, ");
--- END ---

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.30-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages net-tools depends on:
ii  libc6                         2.9-26     GNU C Library: Shared libraries

net-tools recommends no packages.

net-tools suggests no packages.

-- debconf-show failed




Reply sent to Utkarsh Gupta <utkarsh@debian.org>:
You have taken responsibility. (Fri, 02 Oct 2020 10:09:03 GMT) (full text, mbox, link).


Notification sent to Ben Hutchings <ben@decadent.org.uk>:
Bug acknowledged by developer. (Fri, 02 Oct 2020 10:09:03 GMT) (full text, mbox, link).


Message #10 received at 549397-close@bugs.debian.org (full text, mbox, reply):

From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
To: 549397-close@bugs.debian.org
Subject: Bug#549397: fixed in net-tools 1.60+git20181103.0eebece-1
Date: Fri, 02 Oct 2020 10:04:10 +0000
Source: net-tools
Source-Version: 1.60+git20181103.0eebece-1
Done: Utkarsh Gupta <utkarsh@debian.org>

We believe that the bug you reported is fixed in the latest version of
net-tools, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 549397@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Utkarsh Gupta <utkarsh@debian.org> (supplier of updated net-tools package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Fri, 02 Oct 2020 15:01:04 +0530
Source: net-tools
Architecture: source
Version: 1.60+git20181103.0eebece-1
Distribution: unstable
Urgency: medium
Maintainer: net-tools Team <team+net-tools@tracker.debian.org>
Changed-By: Utkarsh Gupta <utkarsh@debian.org>
Closes: 549397 621752 653117 812886
Changes:
 net-tools (1.60+git20181103.0eebece-1) unstable; urgency=medium
 .
   * New upstream version 1.60+git20181103.0eebece
     - Fix nstrcmp() to prevent ifconfig from showing
       duplicate interfaces. (Closes: #812886)
   * Fix d/watch to point to upstream git repository
   * Add patch to fix decoding of MII vendor ids. (Closes: #549397)
     - Thanks, Ben Hutchings, for the patch.
   * Add patch to fix Japanese translation which uses a wrong
     Kanji character. (Closes: #621752)
     - Thanks, Takeshi Hamasaki, for the patch.
   * Add patch to fix wrong indentation of "collisions" in  the
     Japanese translation. (Closes: #653117)
     - Thanks, NODA, Kai, for the patch.
   * Fix Uploaders' field.
     - Add myself as an uploader.
     - Fix Tina's details.
Checksums-Sha1:
 a0c6d9d90713e0b150e1d82fb15f9005a2e51473 2142 net-tools_1.60+git20181103.0eebece-1.dsc
 29ea41401bebf746b11c237f0e8ffce28f7f7759 197516 net-tools_1.60+git20181103.0eebece.orig.tar.xz
 d24e162ea83be80d7f6dd93317414bea6aff5a1a 57356 net-tools_1.60+git20181103.0eebece-1.debian.tar.xz
 217463c1f5ae199e2e00ba4ad8bc1f9c32d098d3 6243 net-tools_1.60+git20181103.0eebece-1_amd64.buildinfo
Checksums-Sha256:
 e1050dd87be399ee55fd449954633d9906171a81dce0ac385a82f8a9f98a1651 2142 net-tools_1.60+git20181103.0eebece-1.dsc
 ab56d30a5e40444083c67cb3940e42ad554f99ae38e027d30c30487b2b7820aa 197516 net-tools_1.60+git20181103.0eebece.orig.tar.xz
 ff1e1cbd0cbde95eb97a25fb00e5b04c13cc16010b31eb02b0397ed7420aa890 57356 net-tools_1.60+git20181103.0eebece-1.debian.tar.xz
 6873fa68239dc0acfc4e7ee64350e07ae7e524972b5fd4aaad223b9537179302 6243 net-tools_1.60+git20181103.0eebece-1_amd64.buildinfo
Files:
 6ef46b1a0885a30de2a46801c353dfbd 2142 net important net-tools_1.60+git20181103.0eebece-1.dsc
 06067b9254dbd34db95400ec61272949 197516 net important net-tools_1.60+git20181103.0eebece.orig.tar.xz
 29e06c2d7db511a5c003897e07536d45 57356 net important net-tools_1.60+git20181103.0eebece-1.debian.tar.xz
 bd9cc35d98df080dcb35e057adabfd91 6243 net important net-tools_1.60+git20181103.0eebece-1_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCAAxFiEEbJ0QSEqa5Mw4X3xxgj6WdgbDS5YFAl929igTHHV0a2Fyc2hA
ZGViaWFuLm9yZwAKCRCCPpZ2BsNLltddEACnP50nIFMY22GlbqQw2lkxqBMbniUd
zqt/q1RfVTufJrV2sFJeWmKvrg9INmTo4mSYJkJDqX1kyrM0CAKtYurQJU5eQ5Ti
17tpxahq/1tI+NPoIOEfRsYhZ8g6zkMKh2vlVu9ylQ3kkLsAsHcbfZVpniia7Z53
hIo9TNu9FLpbXo9TKOWAyOk2W7dZd+8YVPlQQrD7OBwzZXsS+Rwc9JX2CSzd18VW
Sx3z/+up/XcZsQ43QZU09VRN4+FE+7fFk9TezZreRCfLWH2l2cgYNwrwgRaCxWeB
TQDhylmJvQ1iMcu40yceCQlHu29fql5dWh0OcD7dqIsbSXaQSEqViSat3cmiKaHA
+C1y04k73O6Ynd5R38whKQDRBuJDmhAXQ4VlJrdiGU425mliItIvoA2ex3iaPWOR
+1MUOqn4IBQU317k3xJ8SvOC7AkGkJulWHvJDkyKlh2BdyhpLpGU6qq8G+gxsDh5
foqoVKXF9b+Ei/LY6PQQWjYe/Ez9oWV3XoUesQYkCnDmXfmCKskOZdIC+tsQFCS+
JJroF6I5Q8G22tdJniHFgsI4mx3da3V0yFzoFRYfIdNf0LKM0PptiTwfpc9C7FC+
m+lHk+E/yHIPhiQj0+YHQTM+XUtkmeDxQPl4XN9dygMauPCbp+3vXQb6pA/qYRAJ
6yX5rRhrjiwBsg==
=ApCl
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 04 Nov 2020 07:26:56 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Oct 8 03:05:14 2023; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.