Module af_packet

Module af_packet 

Source
Expand description

Shared AF_PACKET infrastructure for raw Ethernet faces.

Contains socket helpers and the TPACKET_V2 mmap’d ring buffer used by both NamedEtherFace (unicast) and MulticastEtherFace.

MacAddr is re-exported from ndn-transport — it is the shared canonical type used across the whole stack. Defining a second copy here caused a type-mismatch on Linux when passing MACs to NeighborUpdate::AddFace.

Structs§

MacAddr
A 6-byte IEEE 802 MAC address.
PacketRing
Mmap’d PACKET_RX_RING + PACKET_TX_RING for zero-copy packet I/O.

Functions§

get_ifindex
Look up the interface index for iface via SIOCGIFINDEX.
get_interface_mac
Query the hardware (MAC) address of iface via SIOCGIFHWADDR.
make_sockaddr_ll
Build a sockaddr_ll for bind or sendto.
open_packet_socket
Create an AF_PACKET + SOCK_DGRAM socket bound to ifindex, filtering only frames with ethertype protocol. Returns a non-blocking OwnedFd.
setsockopt_val
Generic setsockopt wrapper for a value of type T.
setup_packet_ring
Configure TPACKET_V2, create RX + TX rings, and mmap them.