Date: Sat, 10 Dec 2022 21:27:16 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268305] ether_gen_addr() uses wrong OUI range Message-ID: <bug-268305-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268305 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 OUI= s in range 000000..00ffff or 100000..10ffff.=20 In if_ethersubr.c you see addr =3D ((digest[0] << 16) | (digest[1] << 8) | digest[2]) & OUI_FREEBSD_GENERATED_MASK; addr =3D OUI_FREEBSD(addr); The first line generates an address in range 000000..00ffff or 100000..10ff= ff=20 It should be=20 addr =3D ((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=20 addr =3D 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.=20 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 --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268305-227>