#include <net/if.h>
net/if.h 70 macros · 17 structs · 4 functions
size 16, align 8
int ifcr_total total cloners (out) int ifcr_count room for this many in user buffer char * ifcr_buffer buffer for cloner names
#define IFF_UP 0x1 interface is up
#define IFF_BROADCAST 0x2 broadcast address valid
#define IFF_DEBUG 0x4 turn on debugging
#define IFF_LOOPBACK 0x8 is a loopback net
#define IFF_POINTOPOINT 0x10 interface is point-to-point link
#define IFF_NOTRAILERS 0x20 obsolete: avoid use of trailers
#define IFF_RUNNING 0x40 resources allocated
#define IFF_NOARP 0x80 no address resolution protocol
#define IFF_PROMISC 0x100 receive all packets
#define IFF_ALLMULTI 0x200 receive all multicast packets
#define IFF_OACTIVE 0x400 transmission in progress
#define IFF_SIMPLEX 0x800 can't hear own transmissions
#define IFF_LINK0 0x1000 per link layer defined bit
#define IFF_LINK1 0x2000 per link layer defined bit
#define IFF_LINK2 0x4000 per link layer defined bit
#define IFF_ALTPHYS IFF_LINK2 use alternate physical connection
#define IFF_MULTICAST 0x8000 supports multicast
Capabilities that interfaces can advertise.
struct ifnet.if_capabilities
contains the optional features & capabilities a particular interface
supports (not only the driver but also the detected hw revision).
Capabilities are defined by IFCAP_* below.
struct ifnet.if_capenable
contains the enabled (either by default or through ifconfig) optional
features & capabilities on this interface.
Capabilities are defined by IFCAP_* below.
struct
if_data .ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h,
contains the enabled optional features & capabilites that can be used
individually per packet and are specified in the mbuf pkthdr.csum_flags
field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be
more detailed or differentiated than IFCAP_*.
IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h
#define IFCAP_RXCSUM 0x00001 can offload checksum on RX
#define IFCAP_TXCSUM 0x00002 can offload checksum on TX
#define IFCAP_VLAN_MTU 0x00004 VLAN-compatible MTU
#define IFCAP_VLAN_HWTAGGING 0x00008 hardware VLAN tag support
#define IFCAP_JUMBO_MTU 0x00010 9000 byte MTU supported
#define IFCAP_TSO4 0x00020 can do TCP Segmentation Offload
#define IFCAP_TSO6 0x00040 can do TCP6 Segmentation Offload
#define IFCAP_LRO 0x00080 can do Large Receive Offload
#define IFCAP_AV 0x00100 can do 802.1 AV Bridging
#define IFCAP_TXSTATUS 0x00200 can return linklevel xmit status
#define IFCAP_SKYWALK 0x00400 Skywalk mode supported/enabled
#define IFCAP_HW_TIMESTAMP 0x00800 Time stamping in hardware
#define IFCAP_SW_TIMESTAMP 0x01000 Time stamping in software
#define IFCAP_CSUM_PARTIAL 0x02000 can offload partial checksum
#define IFCAP_CSUM_ZERO_INVERT 0x04000 can invert 0 to -0 (0xffff)
#define IFCAP_LRO_NUM_SEG 0x08000 NIC & driver can set the num of segments a LRO-packet is built of
#define IFNET_SLOWHZ 1 granularity is 1 second
Message format for use in obtaining information about interfaces
from sysctl and the routing socket
size 112, align 4
unsigned short ifm_msglen to skip non-understood messages unsigned char ifm_version future binary compatability unsigned char ifm_type message type int ifm_addrs like rtm_addrs int ifm_flags value of if_flags unsigned short ifm_index index for associated ifp struct if_data ifm_data statistics and other data about if
Message format for use in obtaining information about interface addresses
from sysctl and the routing socket
size 20, align 4
unsigned short ifam_msglen to skip non-understood messages unsigned char ifam_version future binary compatability unsigned char ifam_type message type int ifam_addrs like rtm_addrs int ifam_flags value of ifa_flags unsigned short ifam_index index for associated ifp int ifam_metric value of ifa_metric
Message format for use in obtaining information about multicast addresses
from the routing socket
size 16, align 4
unsigned short ifmam_msglen to skip non-understood messages unsigned char ifmam_version future binary compatability unsigned char ifmam_type message type int ifmam_addrs like rtm_addrs int ifmam_flags value of ifa_flags unsigned short ifmam_index index for associated ifp
Message format for use in obtaining information about interfaces
from sysctl
size 160, align 4
u_short ifm_msglen to skip over non-understood messages u_char ifm_version future binary compatability u_char ifm_type message type int ifm_addrs like rtm_addrs int ifm_flags value of if_flags u_short ifm_index index for associated ifp int ifm_snd_len instantaneous length of send queue int ifm_snd_maxlen maximum length of send queue int ifm_snd_drops number of drops in send queue int ifm_timer time until if_watchdog called struct if_data64 ifm_data statistics and other data
Message format for use in obtaining information about multicast addresses
from sysctl
size 20, align 4
u_short ifmam_msglen to skip over non-understood messages u_char ifmam_version future binary compatability u_char ifmam_type message type int ifmam_addrs like rtm_addrs int ifmam_flags value of ifa_flags u_short ifmam_index index for associated ifp int32_t ifmam_refcount
ifdevmtu: interface device mtu
Used with
SIOCGIFDEVMTU to get the current mtu in use by the device,
as well as the minimum and maximum mtu allowed by the device.
size 12, align 4
int ifdm_current int ifdm_min int ifdm_max
size 16, align 4
unsigned int ifk_module_id unsigned int ifk_type unnamed union at net/if.h:271:2 ifk_data void * ifk_ptr int ifk_value
Wake capabilities of a interface
#define IF_WAKE_ON_MAGIC_PACKET 0x01 size 32, align 8
char[16] ifr_name if name, e.g. "en0" unnamed union at net/if.h:295:2 ifr_ifru
#define IFRTYPE_FUNCTIONAL_UNKNOWN 0 #define IFRTYPE_FUNCTIONAL_LOOPBACK 1 #define IFRTYPE_FUNCTIONAL_WIRED 2 #define IFRTYPE_FUNCTIONAL_WIFI_INFRA 3 #define IFRTYPE_FUNCTIONAL_WIFI_AWDL 4 #define IFRTYPE_FUNCTIONAL_CELLULAR 5 #define IFRTYPE_FUNCTIONAL_INTCOPROC 6 #define IFRTYPE_FUNCTIONAL_COMPANIONLINK 7 #define IFRTYPE_FUNCTIONAL_MANAGEMENT 8 #define IFRTYPE_FUNCTIONAL_LAST 8 #define ifr_addr ifr_ifru.ifru_addr address
#define ifr_dstaddr ifr_ifru.ifru_dstaddr other end of p-to-p link
#define ifr_broadaddr ifr_ifru.ifru_broadaddr broadcast address
#define ifr_flags ifr_ifru.ifru_flags flags
#define ifr_metric ifr_ifru.ifru_metric metric
#define ifr_mtu ifr_ifru.ifru_mtu mtu
#define ifr_phys ifr_ifru.ifru_phys physical wire
#define ifr_data ifr_ifru.ifru_data for use by interface
#define ifr_devmtu ifr_ifru.ifru_devmtu #define ifr_intval ifr_ifru.ifru_intval integer value
#define ifr_kpi ifr_ifru.ifru_kpi #define ifr_wake_flags ifr_ifru.ifru_wake_flags wake capabilities
#define ifr_route_refcnt ifr_ifru.ifru_route_refcnt route references count
#define ifr_reqcap ifr_ifru.ifru_cap[0] requested capabilities
#define ifr_curcap ifr_ifru.ifru_cap[1] current capabilities
size 40, align 4
char[16] ifd_name if name, e.g. "en0" unsigned long ifd_cmd size_t ifd_len length of ifd_data buffer void * ifd_data
#define IFSTATMAX 800 10 lines of text
size 817, align 1
char[16] ifs_name if name, e.g. "en0" char[801] ascii
Structure used in
SIOCGIFCONF request.
Used to retrieve interface configuration
for machine (useful for programs which
must know all networks accessible).
size 12, align 4
int ifc_len size of associated buffer unnamed union at net/if.h:421:2 ifc_ifcu
#define ifc_buf ifc_ifcu.ifcu_buf buffer address
#define ifc_req ifc_ifcu.ifcu_req array of structures returned
size 16, align 8
unsigned int if_index 1, 2, ... char * if_name null terminated name: "le0", ...
unsigned int if_nametoindex(const char *) man page · November 23, 2005
if_nametoindex(3) — provide mappings between interface names and indexes
char *if_indextoname(unsigned int, char *) man page · November 23, 2005
if_indextoname(3) — provide mappings between interface names and indexes
struct if_nameindex *if_nameindex(void) man page · November 23, 2005
if_nameindex(3) — provide mappings between interface names and indexes
Generated 2026-09-08 from the headers of one specific machine (macOS 26.4.1, SDK 26.4, arm64) — not official documentation. About & caveats