From owner-svn-src-all@freebsd.org Tue Sep 3 14:07:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6871DDCB9D; Tue, 3 Sep 2019 14:06:34 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7zY4M1Yz4PhB; Tue, 3 Sep 2019 14:06:33 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id D2D2C1A86C; Tue, 3 Sep 2019 14:06:11 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id E6DE22675; Tue, 9 Apr 2019 19:48:18 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4515876C46; Tue, 9 Apr 2019 19:48:18 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1A5FC262D; Tue, 9 Apr 2019 19:48:18 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id B19A42628; Tue, 9 Apr 2019 19:48:15 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37C4F76C3C; Tue, 9 Apr 2019 19:48:15 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x39JmBQ7061858; Tue, 9 Apr 2019 12:48:11 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x39JmBZk061857; Tue, 9 Apr 2019 12:48:11 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201904091948.x39JmBZk061857@gndrsh.dnsmgr.net> Subject: Re: svn commit: r346052 - head/sys/dev/usb/net In-Reply-To: <47360aeb-c2d0-7fc9-1924-399c34766547@FreeBSD.org> To: John Baldwin CC: Ian Lepore , Ganbold Tsagaankhuu , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 4515876C46 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:07:13 -0000 X-Original-Date: Tue, 9 Apr 2019 12:48:11 -0700 (PDT) X-List-Received-Date: Tue, 03 Sep 2019 14:07:13 -0000 > On 4/9/19 9:59 AM, Ian Lepore wrote: > > On Tue, 2019-04-09 at 09:33 -0700, John Baldwin wrote: > >> On 4/9/19 9:17 AM, Ian Lepore wrote: > >>> On Tue, 2019-04-09 at 09:11 -0700, John Baldwin wrote: > >>>> On 4/9/19 6:54 AM, Ganbold Tsagaankhuu wrote: > >>>>> Author: ganbold > >>>>> Date: Tue Apr 9 13:54:08 2019 > >>>>> New Revision: 346052 > >>>>> URL: https://svnweb.freebsd.org/changeset/base/346052 > >>>>> > >>>>> Log: > >>>>> In some cases like NanoPI R1, its second USB ethernet > >>>>> RTL8152 (chip version URE_CHIP_VER_4C10) doesn't > >>>>> have hardwired MAC address, in other words, it is all zeros. > >>>>> This commit fixes it by setting random MAC address > >>>>> when MAC address is all zeros. > >>>>> > >>>>> Reviewed by: kevlo > >>>>> Differential Revision: > >>>>> https://reviews.freebsd.org/D19856 > >>>> > >>>> It would be best to not use a purely random mac address and to > >>>> use > >>>> the > >>>> function kevans@ added recently. That function generates a MAC > >>>> address > >>>> from the FreeBSD OUI using a cryptographic hash so you get a > >>>> stable address across boots on a given host. > >>>> > >>> > >>> How could that possibly work? If it's not random, you can't have > >>> two > >>> such devices on the same network. If it is random, it's not stable > >>> from one boot to the next. > >> > >> It uses the UUID and interface name as input into the hash. > > > >> The UUID is per-host. > > > > Oh, so it only works on x86 (or I guess any system that has something > > like a bios that can provide you with a uuid that doesn't change from > > one boot to the next). > > The function is in one centralized place where you are free to add other > data as input into the hash. We do always generate a uuid that we save > on boot if we aren't seeded with one by firmware, though that is probably > too late for this driver (so +1 may in fact be a better route). It should > be fine for psuedo interfaces created post-boot though even on non-x86 due > to /etc/rc.d/hostid. Pure random MAC's are not really great either. Cant the loader load /etc/rc.d/hostid and put it in something that the kernel could get at, or a module written that handles this? > -- > John Baldwin -- Rod Grimes rgrimes@freebsd.org