Date: Thu, 18 Jul 2002 16:15:32 -0700 (PDT) From: Bill Baumann <bbaumann@isilon.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/40745: Inconsistency between net/if.c and struct arpcom alignment in awi, lnc, pdq, and ray ethernet drivers Message-ID: <200207182315.g6INFWB8050724@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 40745 >Category: kern >Synopsis: Inconsistency between net/if.c and struct arpcom alignment in awi, lnc, pdq, and ray ethernet drivers >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jul 18 16:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Bill Baumann >Release: 5.0-CURRENT >Organization: Isilon >Environment: >Description: In net/if.c in a couple of places, the ethernet address is needed. This is stored in the arpcom structure. A couple lines of code in if.c require struct arpcom be at the very begining of device softc structures. Nearly all drivers observe this. However, several do not. net/if.c routines if_findindex() and if_setlladdr() gain access to the ethernet address via the following expression: ((struct arpcom *)ifp->if_softc)->ac_enaddr The above code assumes that the if_softc pointer is equivalent to an struct arpcom pointer. The awi, ray, lnc and pdq drivers have other fields at the beginning of their softc structures. Attempts to set the ethernet address of these devices should cause corruption. >How-To-Repeat: >Fix: Two possible changes -- Change if.c to use the following instead: ((struct arpcom *)ifp)->ac_enaddr Or change the arpcom structure alignment in all four drivers. In a discussion on freebsd-net@FreeBSD.ORG, the consensus was that arpcom should be at the beginning of softc. Apparently, page 77 of Stevens' TCP/IP Illustrated Volume 2 documents this. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207182315.g6INFWB8050724>