mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
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
This commit is contained in:
parent
79bfb05b07
commit
072afcdffc
1 changed files with 7 additions and 3 deletions
|
|
@ -98,7 +98,7 @@ edsc_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
|||
{
|
||||
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.
|
||||
|
|
@ -148,12 +148,16 @@ edsc_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
|||
*/
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue