Date: Mon, 2 Mar 2020 02:45:57 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r358515 - head/sys/net Message-ID: <202003020245.0222jvg5016372@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Mon Mar 2 02:45:57 2020 New Revision: 358515 URL: https://svnweb.freebsd.org/changeset/base/358515 Log: if_edsc: generate an arbitrary MAC address When generating an cloned interface instance in edsc_clone_create(), generate a MAC address from the FF OUI with ether_gen_addr(). This allows us to have unique local-link addresses. Previously, the MAC address was zero. Submitted by: Neel Chauhan <neel AT neelc DOT org> Differential Revision: https://reviews.freebsd.org/D23842 Modified: head/sys/net/if_edsc.c Modified: head/sys/net/if_edsc.c ============================================================================== --- head/sys/net/if_edsc.c Mon Mar 2 02:45:52 2020 (r358514) +++ head/sys/net/if_edsc.c Mon Mar 2 02:45:57 2020 (r358515) @@ -98,7 +98,7 @@ edsc_clone_create(struct if_clone *ifc, int unit, cadd { struct edsc_softc *sc; struct ifnet *ifp; - static u_char eaddr[ETHER_ADDR_LEN]; /* 0:0:0:0:0:0 */ + struct ether_addr eaddr; /* * Allocate soft and ifnet structures. Link each to the other. @@ -149,11 +149,15 @@ edsc_clone_create(struct if_clone *ifc, int unit, cadd ifp->if_snd.ifq_maxlen = ifqmaxlen; /* + * Generate an arbitrary MAC address for the cloned interface. + */ + ether_gen_addr(ifp, &eaddr); + + /* * Do ifnet initializations common to all Ethernet drivers * and attach to the network interface framework. - * TODO: Pick a non-zero link level address. */ - ether_ifattach(ifp, eaddr); + ether_ifattach(ifp, eaddr.octet); /* * Now we can mark the interface as running, i.e., ready
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003020245.0222jvg5016372>