From owner-freebsd-bugs@FreeBSD.ORG Tue Mar 31 10:00:01 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98940106564A for ; Tue, 31 Mar 2009 10:00:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5EA8E8FC15 for ; Tue, 31 Mar 2009 10:00:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n2VA01fG047639 for ; Tue, 31 Mar 2009 10:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n2VA01LS047638; Tue, 31 Mar 2009 10:00:01 GMT (envelope-from gnats) Resent-Date: Tue, 31 Mar 2009 10:00:01 GMT Resent-Message-Id: <200903311000.n2VA01LS047638@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Gavin Atkinson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7842A106566C for ; Tue, 31 Mar 2009 09:55:16 +0000 (UTC) (envelope-from gavin@rho.york.ac.uk) Received: from mail-gw1.york.ac.uk (mail-gw1.york.ac.uk [144.32.128.246]) by mx1.freebsd.org (Postfix) with ESMTP id 286A18FC12 for ; Tue, 31 Mar 2009 09:55:15 +0000 (UTC) (envelope-from gavin@rho.york.ac.uk) Received: from mail-gw6.york.ac.uk (mail-gw6.york.ac.uk [144.32.129.26]) by mail-gw1.york.ac.uk (8.13.6/8.13.6) with ESMTP id n2V9tCKA029366 for ; Tue, 31 Mar 2009 10:55:12 +0100 (BST) Received: from buffy-128.york.ac.uk ([144.32.128.160] helo=buffy.york.ac.uk) by mail-gw6.york.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1Loaga-0004qv-OO for FreeBSD-gnats-submit@freebsd.org; Tue, 31 Mar 2009 10:55:12 +0100 Received: from rho.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.3/8.14.3) with ESMTP id n2V9aDSB083792 for ; Tue, 31 Mar 2009 10:36:13 +0100 (BST) (envelope-from gavin@rho.york.ac.uk) Received: (from gavin@localhost) by rho.york.ac.uk (8.14.3/8.14.3/Submit) id n2V9Zuhb002487; Tue, 31 Mar 2009 10:35:56 +0100 (BST) (envelope-from gavin) Message-Id: <200903310935.n2V9Zuhb002487@rho.york.ac.uk> Date: Tue, 31 Mar 2009 10:35:56 +0100 (BST) From: Gavin Atkinson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/133239: [ae] [jme] if_jme can assign duplicate MAC address X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Gavin Atkinson List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2009 10:00:02 -0000 >Number: 133239 >Category: kern >Synopsis: [ae] [jme] if_jme can assign duplicate MAC address >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Mar 31 10:00:00 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Gavin Atkinson >Release: FreeBSD 8.0-CURRENT i386 >Organization: >Environment: System: FreeBSD rho.york.ac.uk 8.0-CURRENT FreeBSD 8.0-CURRENT #45: Sun Mar 29 17:36:55 BST 2009 root@rho.york.ac.uk:/usr/obj/usr/src/sys/RHO i386 i386 >Description: If jme(4) cannot read the MAC address from the eeprom, it will generate a fake MAC address using arc4random(). However, when doing this it uses an OUI that is assigned to ASUSTek, and doesn't set the "locally-assigned" bit, meaning that this has the potential to clash with other machines, as well as generally not being a nice thing to do. Additionally, ae(4) suffers a similar problem, although at least that driver does set the "locally-assigned" bit. >How-To-Repeat: N/A >Fix: Fix these drivers in the same way as ate(4) was fixed: use a locally assigned address rather than stealing one. The best way this is currently done in FreeBSD seems to be to set the first three bytes to 'b', 's', 'd' - so do the same here. This works as 'b' has the "llocally-assigned" bit set. --- ae_jme_macaddress.diff begins here --- Index: src/sys/dev/ae/if_ae.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ae/if_ae.c,v retrieving revision 1.3 diff -u -r1.3 if_ae.c --- src/sys/dev/ae/if_ae.c 4 Feb 2009 20:35:31 -0000 1.3 +++ src/sys/dev/ae/if_ae.c 31 Mar 2009 09:02:38 -0000 @@ -1072,11 +1072,13 @@ eaddr[0] = arc4random(); /* - * Set OUI to ASUSTek COMPUTER INC. + * Set OUI to convenient locally assigned address. 'b' + * is 0x62, which has the locally assigned bit set, and + * the broadcast/multicast bit clear. */ - sc->eaddr[0] = 0x02; /* U/L bit set. */ - sc->eaddr[1] = 0x1f; - sc->eaddr[2] = 0xc6; + sc->eaddr[0] = 'b'; + sc->eaddr[1] = 's'; + sc->eaddr[2] = 'd'; sc->eaddr[3] = (eaddr[0] >> 16) & 0xff; sc->eaddr[4] = (eaddr[0] >> 8) & 0xff; sc->eaddr[5] = (eaddr[0] >> 0) & 0xff; Index: src/sys/dev/jme/if_jme.c =================================================================== RCS file: /home/ncvs/src/sys/dev/jme/if_jme.c,v retrieving revision 1.10 diff -u -r1.10 if_jme.c --- src/sys/dev/jme/if_jme.c 4 Dec 2008 02:16:53 -0000 1.10 +++ src/sys/dev/jme/if_jme.c 31 Mar 2009 08:59:13 -0000 @@ -460,10 +460,15 @@ device_printf(sc->jme_dev, "generating fake ethernet address.\n"); par0 = arc4random(); - /* Set OUI to JMicron. */ - sc->jme_eaddr[0] = 0x00; - sc->jme_eaddr[1] = 0x1B; - sc->jme_eaddr[2] = 0x8C; + + /* + * Set OUI to convenient locally assigned address. 'b' + * is 0x62, which has the locally assigned bit set, and + * the broadcast/multicast bit clear. + */ + sc->jme_eaddr[0] = 'b'; + sc->jme_eaddr[1] = 's'; + sc->jme_eaddr[2] = 'd'; sc->jme_eaddr[3] = (par0 >> 16) & 0xff; sc->jme_eaddr[4] = (par0 >> 8) & 0xff; sc->jme_eaddr[5] = par0 & 0xff; --- ae_jme_macaddress.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: