- NetBSD Manual Pages
ETHERSUBR(9) NetBSD Kernel Developer's Manual ETHERSUBR(9)
Powered by man-cgi (2021-03-02).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
ethersubr, ether_ifattach, ether_addmulti, ether_delmulti,
ETHER_FIRST_MULTI, ETHER_NEXT_MULTI, ETHER_IS_MULTICAST -- Ethernet
driver support functions and macros
ether_ifattach(struct ifnet *ifp, uint8_t *lla);
ether_addmulti(const struct sockaddr *sa, struct ethercom *ec);
ether_delmulti(const struct sockaddr *sa, struct ethercom *ec);
ETHER_FIRST_MULTI(struct ether_multistep step, struct ethercom *ec,
struct ether_multi *enm);
ETHER_NEXT_MULTI(struct ether_multistep step, struct ether_multi *enm);
The ethersubr functions provide the interface between the ethersubr mod-
ule and the network drivers which need Ethernet support. Such drivers
must request the ether attribute in their files declaration and call the
appropriate functions as specified below.
Note that you also need the arp(9) stuff to support IPv4 on your hard-
Perform the device-independent, but Ethernet-specific initial-
ization of the interface pointed to by ifp.
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 by lla there. Drivers can ini-
tialize the link level address by themselves by calling the
function with lla as NULL and calling if_set_sadl().
This function must be called from the driver's attach function.
Add (ether_addmulti()) or delete (ether_delmulti()) the address
described by the sa pointer to the Ethernet multicast list
belonging to ec.
These functions must be called from the driver's ioctl function
to handle SIOCADDMULTI and SIOCDELMULTI requests. If these
return ENETRESET, the hardware multicast filter must be reini-
These functions accept AF_UNSPEC addresses, which are inter-
preted as Ethernet addresses, or AF_INET addresses. In the lat-
ter case, INADDR_ANY is mapped to a range describing all the
Ethernet address space reserved for IPv4 multicast addresses.
The 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.
The ether_delmulti() returns, in addition to the above errors,
ENXIO if the specified address can't be found in the list of
A macro to step through all of the ether_multi records, one at a
time. The current position is remembered in step, which the
caller must provide.
ETHER_FIRST_MULTI(step, ec, enm)
A macro that must be called to initialize step and get the first
record. Both macros return a NULL enm when there are no remain-
A macro that returns 1, if addr points to an Ethernet/FDDI mul-
ticast (or broadcast) address.
Ethernet support functions are declared in <net/if_ether.h> and defined
(if not implemented as macro) in sys/net/if_ethersubr.c.
Rewritten to attach to the new ARP system in NetBSD 1.3.
UCB CSRG (original implementation)
Ignatios Souvatzis (support for new ARP system)
NetBSD 9.99 January 19, 2020 NetBSD 9.99