Date: Thu, 15 Apr 2021 16:20:23 -0400 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: Kyle Evans <kevans@freebsd.org> Cc: Kevin Bowling <kevin.bowling@kev009.com>, Ronald Klop <ronald-lists@klop.ws>, Kevin Bowling <kbowling@freebsd.org>, src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org Subject: Re: git: 68a46f11eada - main - e1000: Restore VF interface random MAC Message-ID: <20210415202023.oms4sih6eina57xu@mutt-hbsd> In-Reply-To: <CACNAnaFnp5HNX09GDi3C%2BOtUCjB=bAymfMfvyFL35dzvr6CFRQ@mail.gmail.com> References: <202104151848.13FImMA5091035@gitrepo.freebsd.org> <5b50b23a-71cd-5221-c905-ccffe841bc98@klop.ws> <CACNAnaFzdufDyvuafqu%2BUsDSfsJwjQhRew5iG1-gUsyAv45xXg@mail.gmail.com> <CAK7dMtCLj2h2W5pyf1t7aD7QO1k66TSAX9abE4-KuD2cSJqJ7g@mail.gmail.com> <CACNAnaFnp5HNX09GDi3C%2BOtUCjB=bAymfMfvyFL35dzvr6CFRQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--76ntzjfnoskhjo4p Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Could ether_gen_addr be updated to take into account the zero'd hostuuid and handle appropriately like you mentioned below?=20 On Thu, Apr 15, 2021 at 03:12:14PM -0500, Kyle Evans wrote: > I think it'd be the right choice, but it needs a little work first. > e.g., it's not a good fit right now for VMs that don't use loader, for > instance, because it relies on the hostuuid actually being somewhat > unique or else it generates the same MAC address across different VMs > and you end up with conflicts in the broadcast domain. I think there's > a good argument to make for having it check if the hostuuid is the > default all-0 hostuuid and just generating a random address as this > does right now. I might go ahead and prepare such a change and > document the KPI in the process. >=20 > On Thu, Apr 15, 2021 at 3:06 PM Kevin Bowling <kevin.bowling@kev009.com> = wrote: > > > > I would like to discuss this further, it crossed my mind, but none of > > the intel drivers currently use it. If this is the right KPI I think > > a review should be prepared that updates e1000, ixgbe (ixv), ixl > > (iavf) in one go. > > > > Regards, > > Kevin > > > > On Thu, Apr 15, 2021 at 12:36 PM Kyle Evans <kevans@freebsd.org> wrote: > > > > > > On Thu, Apr 15, 2021 at 2:32 PM Ronald Klop <ronald-lists@klop.ws> wr= ote: > > > > > > > > On 4/15/21 8:48 PM, Kevin Bowling wrote: > > > > > The branch main has been updated by kbowling (ports committer): > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D68a46f11eadab48a1d= a9e3d3900569a6a1ce142e > > > > > > > > > > commit 68a46f11eadab48a1da9e3d3900569a6a1ce142e > > > > > Author: Kevin Bowling <kbowling@FreeBSD.org> > > > > > AuthorDate: 2021-04-15 18:45:02 +0000 > > > > > Commit: Kevin Bowling <kbowling@FreeBSD.org> > > > > > CommitDate: 2021-04-15 18:45:02 +0000 > > > > > > > > > > e1000: Restore VF interface random MAC > > > > > > > > > > Restore 525e07418c77 after the iflib conversion of igb(4). T= his > > > > > reenables random MAC address generation when attaching to a = VF with a > > > > > zeroed MAC. > > > > > > > > > > PR: 253535 > > > > > Reported by: Balaev PA <mail@void.so> > > > > > Reviewed by: markj > > > > > MFC after: 2 weeks > > > > > Differential Revision: https://reviews.freebsd.org/D29785 > > > > > --- > > > > > sys/dev/e1000/if_em.c | 21 ++++++++++++++++++--- > > > > > 1 file changed, 18 insertions(+), 3 deletions(-) > > > > > > > > > > diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c > > > > > index 6f022c80c01c..79a617b3342f 100644 > > > > > --- a/sys/dev/e1000/if_em.c > > > > > +++ b/sys/dev/e1000/if_em.c > > > > > @@ -1061,9 +1061,17 @@ em_if_attach_pre(if_ctx_t ctx) > > > > > } > > > > > > > > > > if (!em_is_valid_ether_addr(hw->mac.addr)) { > > > > > - device_printf(dev, "Invalid MAC address\n"); > > > > > - error =3D EIO; > > > > > - goto err_late; > > > > > + if (adapter->vf_ifp) { > > > > > + u8 addr[ETHER_ADDR_LEN]; > > > > > + arc4rand(&addr, sizeof(addr), 0); > > > > > + addr[0] &=3D 0xFE; > > > > > + addr[0] |=3D 0x02; > > > > > + bcopy(addr, hw->mac.addr, sizeof(addr)); > > > > > + } else { > > > > > + device_printf(dev, "Invalid MAC address\n"); > > > > > + error =3D EIO; > > > > > + goto err_late; > > > > > + } > > > > > > > > > > > > Just curious. Would ether_gen_addr() be useful here? > > > > It is implemented in net/if_ethersubr.c. > > > > > > > > > > I had asked myself the same question, but I suspect these machines may > > > not necessarily have a hostuuid preloaded to avoid collisions from the > > > generated addresses. > > > > > > Thanks, > > > > > > Kyle Evans > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd= =2Eorg" --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --76ntzjfnoskhjo4p Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmB4oAQACgkQ/y5nonf4 4fpOuw//eLn9TUkn8GZdpfAd4mWpX7rWBsjV1XuybzynIZF0pzwSOv3VJY4BTMFq KRnVNSd2vjjE55mlTLqQQ3UxH0qEIjK1ZYAHZ5Hv4EJ0CGmtn6MckPlKF6Jd8OK5 YcIAMx/qmmgaDviPAvtaRZiyUkLJB2Kpv/LZ0ClBCUMm4pSQghvhUfIl8gEfeG0K iBrfKQLW/b+llOGsBVAZqe9xBRt2vMJ57n11WvtAJZ+JxaaI7TwQvh/yN7M4syzF 3KfX5hm7Uc0phGDFs8eCobx3Km3kG4U9+NQ+zt7kPbKWcAFjoAJJx1tnIbyvHj+W W2DBjSD1gpY9/BFYDEJxsV0lu89sVcUcwR4VruhWcHVEWM6Vm0VXEpIxvHsnCLcs ot3Lp+xwBpgywjC5KtrgF789okj3s/c4ynhpJ1APitAluSgv75TMmnX5qUiNhcb5 18L+bKAGxG5H/z9NVDO1T6C61gguQWmdBue7usplCt1OOIpIQS4Yo6FeSVcDwOhF TOGeUAMXq5f8nzF1YPBDzUtGXTTMMBY6utjtBO2PSZEkrP6gigrWMtvOEaPYv03k qxA06dS44BtvtjxNJuFbTjuT6bCwpjqAbbM0kRRm4IyKchPNjDdtt3DEbzSrhk8Y RaZwQzZnp7/aDEE3JWNRSFqJJ97ZQvSm41/V/cr/6LkFxlVQ9aA= =mTbI -----END PGP SIGNATURE----- --76ntzjfnoskhjo4p--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210415202023.oms4sih6eina57xu>