[Bug 268305] ether_gen_addr() uses wrong OUI range
Date: Sat, 10 Dec 2022 21:27:16 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268305 Bug ID: 268305 Summary: ether_gen_addr() uses wrong OUI range Product: Base System Version: 13.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: topical@gmx.net According to documentation in /usr/include/net/ieee_oui.h ether_gen_addr() should generate OUIs in range 100000..10ffff. In practise, is generates OUIs in range 000000..00ffff or 100000..10ffff. In if_ethersubr.c you see addr = ((digest[0] << 16) | (digest[1] << 8) | digest[2]) & OUI_FREEBSD_GENERATED_MASK; addr = OUI_FREEBSD(addr); The first line generates an address in range 000000..00ffff or 100000..10ffff It should be addr = ((digest[0] << 16) | (digest[1] << 8) | digest[2]) & 0xffff; Probably, we should define a macro for 0xffff The second list uses OUI_FREEBSD which doesn't add 0x100000 to the generated address. It should be addr = OUI_FREEBSD(addr | 0x100000); In general, definitions in ieee_oui.h are a bit misleading. Definition of OUI_FREEBSD_GENERATED_MASK is a mixture of an AND-mask 0xffff and the allocation number 0x10. It would be better to separate them, e.g. OUI_FREEBSD_GENERATED_BASE 0x100000 OUI_FREEBSD_GENERATED_MASK 0xffff OUI_FREEBSD_NVME_BASE 0x200000 OUI_FREEBSD_NVME_MASK 0xffff This way, you can cleanly define e.g. range "0x41800...0x41fff" OUI_FREEBSD_FOO_BASE 0x41800 OUI_FREEBSD_FOO_MASK 0x7ff -- You are receiving this mail because: You are the assignee for the bug.