ETHER_GEN_ADDR(9)
π ETHER_GEN_ADDR(9) π
okay so bestie, welcome to the ether_gen_addr era of the Kernel Developer's Manual β¨ this one's all about handing out a MAC address when nobody assigned one, and honestly? it's giving "fairy godmother but for network interfaces" π§
β¨ NAME β¨
ether_gen_addr β generate an arbitrary MAC address for use π
π¦ SYNOPSIS π¦
like, include these first, obviously:
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/ethernet.h>
void
ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr);
πΈ DESCRIPTION πΈ
The ether_gen_addr() function generates an arbitrary MAC address for use by an ethernet interface that does not have an assigned address π«Ά like, it's literally the fallback bestie.
By default, ether_gen_addr attempts to generate a stable MAC address using the hostid of the jail that the ifp is being added to π
During early boot though, the hostid may not be set on machines that haven't yet populated /etc/hostid, or on machines that do not use loader(8) π (yes, that's a whole thing).
ether_gen_addr can fail to derive a MAC address due to memory allocation failure, or because the hostid has not been populated π In these cases, a locally-administered unicast MAC address will be randomly generated and returned via the hwaddr parameter β no cap, the fallback is still a valid vibe β¨
If ether_gen_addr succeeds, then it will return a MAC address in the FreeBSD Foundation OUI, 58:9c:fc, via the hwaddr parameter π
ngl the two paths are: stable-ish and hostid-based, or random-but-still-locally-administered-unicast. both land in hwaddr. that's the whole deal π
π AUTHORS π
This manual page was written by Kyle Evans <kevans@FreeBSD.org> π iconic of him, fr fr.
and that's the whole page bestie, you ate πβ¨ this little slice of lore comes to you from Debian, dated June 1, 2021, and it's ETHER_GEN_ADDR(9) all the way down π bye bestie, go generate some addresses responsibly π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (C) 2021 Kyle Evans <kevans@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms