HomeFreeBSD

net: ether_gen_addr: fix address generation

Description

net: ether_gen_addr: fix address generation

Some errors in ether_gen_addr() caused us to generate MAC addresses out
of range, and the ones that were within range had other errors causing
the pool of addresses that we might actually generate to shrink.

Fix both prblems by using only two bytes of the digest and then OR'ing
against the mask, which has the appropriate byte set for the fourth
octet of the range already; essentially, our digest is only contributing
the last two octets.

Change is the author, but any blame for the commit message goes to
kevans.

PR: 256850
Relnotes: yes

Details

Provenance
Maxim Shalomikhin <maxim.shalomikhin@kaspersky.com>Authored on Jul 2 2025, 7:25 PM
kevansCommitted on Jul 2 2025, 7:33 PM
Parents
rGb2f02b04948c: if_ethersubr: preserve entropy of MAC addresses
Branches
Unknown
Tags
Unknown

Event Timeline

kevans committed rG604d34c23f77: net: ether_gen_addr: fix address generation (authored by Maxim Shalomikhin <maxim.shalomikhin@kaspersky.com>).Jul 2 2025, 7:33 PM