#include <net/if_ether.h>

net/if_ether.h Kernel.framework

7 functions

functionether_family_init

extern int ether_family_init(void)
Not exported

functionether_demux

errno_t ether_demux(
	ifnet_t interface,
	mbuf_t packet,
	char* header,
	protocol_family_t *protocol
)
These functions may be used for an interface emulating an ethernet interface and not using IOKit. If you use IOKit and the IOKit Ethernet Family, these functions will be set for you. Use these functions when filling out the ifnet_init_params structure.

functionether_add_proto

errno_t ether_add_proto(
	ifnet_t interface,
	protocol_family_t protocol,
	const struct ifnet_demux_desc *demux_list __counted_by(demux_count),
	u_int32_t demux_count
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/net/ether_if_module.c
Adds demux descriptors for a protocol family to an Ethernet interface, typically supplied as the add_proto handler for ifnet_attach_protocol. Each descriptor must be of a supported type with the matching data length: DLIL_DESC_ETYPE2 2-byte Ethernet type DLIL_DESC_SAP 3-byte 802.2 SAP DLIL_DESC_SNAP 5-byte SNAP Returns EINVAL for a wrong data length, ENOTSUP for an unsupported descriptor type, and EADDRINUSE if a matching descriptor is already registered. On failure, descriptors already added for the protocol by this call are removed via ether_del_proto.

functionether_del_proto

errno_t ether_del_proto(ifnet_t interface, protocol_family_t protocol)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/net/ether_if_module.c
Releases all demux descriptor entries owned by the given protocol family on an Ethernet interface (there may be several); the descriptor block itself is freed when the last entry is released. Counterpart of ether_add_proto, typically supplied as the del_proto handler for ifnet_attach_protocol. Returns 0.

functionether_frameout

errno_t ether_frameout(
	ifnet_t interface,
	mbuf_t *packet,
	const struct sockaddr *dest,
	IFNET_LLADDR_T dest_lladdr,
	IFNET_FRAME_TYPE_T frame_type
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/net/ether_if_module.c
Ethernet framing output routine, suitable as an interface's framer function. Prepends an Ethernet header to the packet, filling in the destination link-layer address, the interface's own source address, and the frame type. On a simplex interface, a broadcast packet marked M_LOOP has a copy looped back through lo0, and a packet addressed to the interface's own address is delivered only via loopback, returning EJUSTRETURN to indicate the packet was consumed. Leaves room for VLAN encapsulation on IFT_L2VLAN interfaces. Returns EJUSTRETURN if mbuf prepend fails (packet freed), 0 on success.

functionether_ioctl

errno_t ether_ioctl(ifnet_t interface, u_int32_t command, void* data)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/net/ether_if_module.c
Default ioctl handler for Ethernet interfaces. Handles no commands; ignores its arguments and returns EOPNOTSUPP.

functionether_check_multi

errno_t ether_check_multi(ifnet_t ifp, const struct sockaddr *multicast)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu bsd/net/ether_if_module.c
Verifies that an address is a valid Ethernet multicast address, for use as an interface's check_multi handler. Accepts AF_UNSPEC addresses (raw Ethernet address in sa_data) and AF_LINK sockaddr_dl addresses; returns 0 if the group bit (0x01 in the first octet) is set, EADDRNOTAVAIL if the address is not a multicast address, and EAFNOSUPPORT for any other address family.