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)
Fri, May 10, 10:51 PM
Unknown Object (File)
Fri, May 10, 10:51 PM
Unknown Object (File)
Fri, May 10, 3:02 AM
Unknown Object (File)
Fri, May 10, 3:02 AM
Unknown Object (File)
Thu, May 9, 9:28 PM
Unknown Object (File)
Mon, May 6, 10:25 AM
Unknown Object (File)
Mar 11 2024, 3:12 AM
Unknown Object (File)
Feb 25 2024, 11:01 AM

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.