Page MenuHomeFreeBSD

When generating an cloned interface instance in edsc_clone_create(), generate a random MAC address
ClosedPublic

Authored by nc on Feb 26 2020, 6:03 PM.
Referenced Files
Unknown Object (File)
Sat, May 16, 12:55 AM
Unknown Object (File)
Mon, May 4, 2:42 PM
Unknown Object (File)
Thu, Apr 30, 10:13 PM
Unknown Object (File)
Thu, Apr 30, 9:29 AM
Unknown Object (File)
Apr 24 2026, 1:16 PM
Unknown Object (File)
Apr 24 2026, 12:30 AM
Unknown Object (File)
Apr 23 2026, 9:17 PM
Unknown Object (File)
Apr 16 2026, 3:52 PM

Details

Summary

When generating an cloned interface instance in edsc_clone_create(), generate a MAC address from the 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>

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I'm not sure if something else (meaning something more predictable) should be done instead of a random MAC. Should it?

afedorov added inline comments.
sys/net/if_edsc.c
154 ↗(On Diff #68844)

I think this is incorrect. A multicast or something other incorrect address can be generated.
You may use ether_gen_addr(): http://bxr.su/FreeBSD/sys/net/if_ethersubr.c#1426
This function generate MAC from FreeBSD OUI.
For example, see how if_tuntap do it: http://bxr.su/FreeBSD/sys/net/if_tuntap.c#972

Thanks for the advice. I fixed this.

nc marked an inline comment as done.Feb 26 2020, 6:31 PM

Seems like a good/sane idea

This revision is now accepted and ready to land.Feb 28 2020, 7:30 PM
This revision was automatically updated to reflect the committed changes.