The
ethersubr functions provide the interface between the
ethersubr module 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.
FDDI drivers must request the "fddi" attribute in their "files" declaration and call the functions tagged with "fddi_" or "FDDI_" instead, where different. Some macros are shared.
Note that you also need the
arp(9) stuff to support IPv4 on your hardware.
ether_ifattach(ifp, lla)
Perform the device-independent, but Ethernet-specific initialization 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.
This function must be called from the driver's attach function.
fddi_ifattach(ifp, lla)
Corresponding function for FDDI devices.
ether_delmulti(sa, ec)
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 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.
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 multicast addresses.
fddi_delmulti(sa, ec)
Corresponding functions for FDDI devices.
ETHER_NEXT_MULTI(step, enm)
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 remaining records.
ETHER_IS_MULTICAST(addr)
A macro that returns 1, if addr points to an Ethernet/FDDI multicast (or broadcast) address.