ETHERSUBR(9)
π ETHERSUBR(9) β Ethernet driver support functions and macros
okay so bestie, this is the Kernel Developer's Manual page for ethersubr, and it's literally the Ethernet-driver-support main character. no cap, it's a slay. periodt. π«Ά
π NAME π
The whole squad here is ethersubr, ether_ifattach, ether_addmulti, ether_delmulti, ETHER_FIRST_MULTI, ETHER_NEXT_MULTI, and ETHER_IS_MULTICAST β all about Ethernet driver support functions and macros. β¨
πΈ SYNOPSIS πΈ
#include <net/if_ether.h>
void
ether_ifattach(struct ifnet *ifp, uint8_t *lla);
int
ether_addmulti(const struct sockaddr *sa, struct ethercom *ec);
int
ether_delmulti(const struct sockaddr *sa, struct ethercom *ec);
void
ETHER_FIRST_MULTI(struct ether_multistep step, struct ethercom *ec,
struct ether_multi *enm);
void
ETHER_NEXT_MULTI(struct ether_multistep step, struct ether_multi *enm);
int
ETHER_IS_MULTICAST(uint8_t *addr);
π¦ DESCRIPTION π¦
The ethersubr functions are the interface between the ethersubr module and the network drivers that need Ethernet support. Such drivers must request the ether attribute in their files declaration and call the appropriate functions as specified below. π
π¨ also: you need the arp(9) stuff to support IPv4 on your hardware. iykyk.
ether_ifattach(ifp, lla)β does the device-independent, but Ethernet-specific initialization of the interface pointed to byifp. Among other duties, this function creates a record for the link level address in the interface's address list and records the link level address pointed to byllathere. Drivers can initialize the link level address by themselves by calling the function withllaasNULLand callingif_set_sadl(). This function must be called from the driver's attach function. πether_addmulti(sa, ec)/ether_delmulti(sa, ec)β add (ether_addmulti()) or delete (ether_delmulti()) the address described by thesapointer to the Ethernet multicast list belonging toec. These functions must be called from the driver'sioctlfunction to handleSIOCADDMULTIandSIOCDELMULTIrequests. If these returnENETRESET, the hardware multicast filter must be reinitialized. π«
These functions accept AF_UNSPEC addresses, which are interpreted as Ethernet addresses, or AF_INET addresses. In the latter case, INADDR_ANY is mapped to a range describing all the Ethernet address space reserved for IPv4 multicast addresses. β¨
ether_addmulti() returns EAFNOSUPPORT if an unsupported address family is specified, EINVAL if a non-multicast address is specified, or ENETRESET if the multicast list really changed and the driver should synchronize its hardware filter with it. ether_delmulti() returns, in addition to the above errors, ENXIO if the specified address can't be found in the list of multicast addresses. π
ETHER_NEXT_MULTI(step, enm)β a macro to step through all of theether_multirecords, one at a time. The current position is remembered instep, which the caller must provide. πETHER_FIRST_MULTI(step, ec, enm)β a macro that must be called to initializestepand get the first record. Both macros return aNULLenmwhen there are no remaining records. π―ETHER_IS_MULTICAST(addr)β a macro that returns1, ifaddrpoints to an Ethernet/FDDI multicast (or broadcast) address. π
π§ CODE REFERENCES π§
Ethernet support functions are declared in <net/if_ether.h> and defined (if not implemented as macro) in sys/net/if_ethersubr.c. πΎ
π SEE ALSO π
arp(9)π
π°οΈ HISTORY π°οΈ
It was rewritten to attach to the new ARP system in NetBSD 1.3. β³
π AUTHORS π
- UCB CSRG β original implementation. π«Ά
- Ignatios Souvatzis β support for the new ARP system. π
and that's the whole vibe. this page is from Debian, dated January 19, 2020 β ETHERSUBR(9) out. byeee πβ¨
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 1997 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms