#include <net/if.h>

net/if.h

70 macros · 17 structs · 4 functions

macroIF_NAMESIZE

#define IF_NAMESIZE 16

structif_clonereq

size 16, align 8
intifcr_totaltotal cloners (out)
intifcr_countroom for this many in user buffer
char *ifcr_bufferbuffer for cloner names

macroIFF_UP

#define IFF_UP 0x1
interface is up

macroIFF_BROADCAST

#define IFF_BROADCAST 0x2
broadcast address valid

macroIFF_DEBUG

#define IFF_DEBUG 0x4
turn on debugging

macroIFF_LOOPBACK

#define IFF_LOOPBACK 0x8
is a loopback net

macroIFF_POINTOPOINT

#define IFF_POINTOPOINT 0x10
interface is point-to-point link

macroIFF_NOTRAILERS

#define IFF_NOTRAILERS 0x20
obsolete: avoid use of trailers

macroIFF_RUNNING

#define IFF_RUNNING 0x40
resources allocated

macroIFF_NOARP

#define IFF_NOARP 0x80
no address resolution protocol

macroIFF_PROMISC

#define IFF_PROMISC 0x100
receive all packets

macroIFF_ALLMULTI

#define IFF_ALLMULTI 0x200
receive all multicast packets

macroIFF_OACTIVE

#define IFF_OACTIVE 0x400
transmission in progress

macroIFF_SIMPLEX

#define IFF_SIMPLEX 0x800
can't hear own transmissions

macroIFF_LINK0

#define IFF_LINK0 0x1000
per link layer defined bit

macroIFF_LINK1

#define IFF_LINK1 0x2000
per link layer defined bit

macroIFF_LINK2

#define IFF_LINK2 0x4000
per link layer defined bit

macroIFF_ALTPHYS

#define IFF_ALTPHYS IFF_LINK2
use alternate physical connection

macroIFF_MULTICAST

#define IFF_MULTICAST 0x8000
supports multicast

macroIFCAP_RXCSUM

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

macroIFCAP_TXCSUM

#define IFCAP_TXCSUM 0x00002
can offload checksum on TX

macroIFCAP_VLAN_MTU

#define IFCAP_VLAN_MTU 0x00004
VLAN-compatible MTU

macroIFCAP_VLAN_HWTAGGING

#define IFCAP_VLAN_HWTAGGING 0x00008
hardware VLAN tag support

macroIFCAP_JUMBO_MTU

#define IFCAP_JUMBO_MTU 0x00010
9000 byte MTU supported

macroIFCAP_TSO4

#define IFCAP_TSO4 0x00020
can do TCP Segmentation Offload

macroIFCAP_TSO6

#define IFCAP_TSO6 0x00040
can do TCP6 Segmentation Offload

macroIFCAP_LRO

#define IFCAP_LRO 0x00080
can do Large Receive Offload

macroIFCAP_AV

#define IFCAP_AV 0x00100
can do 802.1 AV Bridging

macroIFCAP_TXSTATUS

#define IFCAP_TXSTATUS 0x00200
can return linklevel xmit status

macroIFCAP_SKYWALK

#define IFCAP_SKYWALK 0x00400
Skywalk mode supported/enabled

macroIFCAP_HW_TIMESTAMP

#define IFCAP_HW_TIMESTAMP 0x00800
Time stamping in hardware

macroIFCAP_SW_TIMESTAMP

#define IFCAP_SW_TIMESTAMP 0x01000
Time stamping in software

macroIFCAP_CSUM_PARTIAL

#define IFCAP_CSUM_PARTIAL 0x02000
can offload partial checksum

macroIFCAP_CSUM_ZERO_INVERT

#define IFCAP_CSUM_ZERO_INVERT 0x04000
can invert 0 to -0 (0xffff)

macroIFCAP_LRO_NUM_SEG

#define IFCAP_LRO_NUM_SEG 0x08000
NIC & driver can set the num of segments a LRO-packet is built of

macroIFCAP_HWCSUM

#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)

macroIFCAP_TSO

#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)

macroIFQ_MAXLEN

#define IFQ_MAXLEN 128

macroIFNET_SLOWHZ

#define IFNET_SLOWHZ 1
granularity is 1 second

structif_msghdr

Message format for use in obtaining information about interfaces from sysctl and the routing socket
size 112, align 4
unsigned shortifm_msglento skip non-understood messages
unsigned charifm_versionfuture binary compatability
unsigned charifm_typemessage type
intifm_addrslike rtm_addrs
intifm_flagsvalue of if_flags
unsigned shortifm_indexindex for associated ifp
struct if_dataifm_datastatistics and other data about if

structifa_msghdr

Message format for use in obtaining information about interface addresses from sysctl and the routing socket
size 20, align 4
unsigned shortifam_msglento skip non-understood messages
unsigned charifam_versionfuture binary compatability
unsigned charifam_typemessage type
intifam_addrslike rtm_addrs
intifam_flagsvalue of ifa_flags
unsigned shortifam_indexindex for associated ifp
intifam_metricvalue of ifa_metric

structifma_msghdr

Message format for use in obtaining information about multicast addresses from the routing socket
size 16, align 4
unsigned shortifmam_msglento skip non-understood messages
unsigned charifmam_versionfuture binary compatability
unsigned charifmam_typemessage type
intifmam_addrslike rtm_addrs
intifmam_flagsvalue of ifa_flags
unsigned shortifmam_indexindex for associated ifp

structif_msghdr2

Message format for use in obtaining information about interfaces from sysctl
size 160, align 4
u_shortifm_msglento skip over non-understood messages
u_charifm_versionfuture binary compatability
u_charifm_typemessage type
intifm_addrslike rtm_addrs
intifm_flagsvalue of if_flags
u_shortifm_indexindex for associated ifp
intifm_snd_leninstantaneous length of send queue
intifm_snd_maxlenmaximum length of send queue
intifm_snd_dropsnumber of drops in send queue
intifm_timertime until if_watchdog called
struct if_data64ifm_datastatistics and other data

structifma_msghdr2

Message format for use in obtaining information about multicast addresses from sysctl
size 20, align 4
u_shortifmam_msglento skip over non-understood messages
u_charifmam_versionfuture binary compatability
u_charifmam_typemessage type
intifmam_addrslike rtm_addrs
intifmam_flagsvalue of ifa_flags
u_shortifmam_indexindex for associated ifp
int32_tifmam_refcount

structifdevmtu

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
intifdm_current
intifdm_min
intifdm_max

structifkpi

size 16, align 4
unsigned intifk_module_id
unsigned intifk_type
unnamed union at net/if.h:271:2ifk_data
void *ifk_ptr
intifk_value

macroIF_WAKE_ON_MAGIC_PACKET

Wake capabilities of a interface
#define IF_WAKE_ON_MAGIC_PACKET 0x01

structifreq

size 32, align 8
char[16]ifr_nameif name, e.g. "en0"
unnamed union at net/if.h:295:2ifr_ifru
struct sockaddrifru_addr
struct sockaddrifru_dstaddr
struct sockaddrifru_broadaddr
shortifru_flags
intifru_metric
intifru_mtu
intifru_phys
intifru_media
intifru_intval
caddr_tifru_data
struct ifdevmtuifru_devmtu
struct ifkpiifru_kpi
u_int32_tifru_wake_flags
u_int32_tifru_route_refcnt
int[2]ifru_cap
u_int32_tifru_functional_type
u_int32_tifru_peer_egress_functional_type
u_int8_tifru_is_directlink
u_int8_tifru_is_vpn
u_int8_tifru_is_companionlink

macroIFRTYPE_FUNCTIONAL_UNKNOWN

#define IFRTYPE_FUNCTIONAL_UNKNOWN 0

macroIFRTYPE_FUNCTIONAL_LOOPBACK

#define IFRTYPE_FUNCTIONAL_LOOPBACK 1

macroIFRTYPE_FUNCTIONAL_WIRED

#define IFRTYPE_FUNCTIONAL_WIRED 2

macroIFRTYPE_FUNCTIONAL_WIFI_INFRA

#define IFRTYPE_FUNCTIONAL_WIFI_INFRA 3

macroIFRTYPE_FUNCTIONAL_WIFI_AWDL

#define IFRTYPE_FUNCTIONAL_WIFI_AWDL 4

macroIFRTYPE_FUNCTIONAL_CELLULAR

#define IFRTYPE_FUNCTIONAL_CELLULAR 5

macroIFRTYPE_FUNCTIONAL_INTCOPROC

#define IFRTYPE_FUNCTIONAL_INTCOPROC 6

macroIFRTYPE_FUNCTIONAL_MANAGEMENT

#define IFRTYPE_FUNCTIONAL_MANAGEMENT 8

macroIFRTYPE_FUNCTIONAL_LAST

#define IFRTYPE_FUNCTIONAL_LAST 8

macroifr_addr

#define ifr_addr ifr_ifru.ifru_addr
address

macroifr_dstaddr

#define ifr_dstaddr ifr_ifru.ifru_dstaddr
other end of p-to-p link

macroifr_broadaddr

#define ifr_broadaddr ifr_ifru.ifru_broadaddr
broadcast address

macroifr_flags

#define ifr_flags ifr_ifru.ifru_flags
flags

macroifr_metric

#define ifr_metric ifr_ifru.ifru_metric
metric

macroifr_mtu

#define ifr_mtu ifr_ifru.ifru_mtu
mtu

macroifr_phys

#define ifr_phys ifr_ifru.ifru_phys
physical wire

macroifr_media

#define ifr_media ifr_ifru.ifru_media
physical media

macroifr_data

#define ifr_data ifr_ifru.ifru_data
for use by interface

macroifr_devmtu

#define ifr_devmtu ifr_ifru.ifru_devmtu

macroifr_intval

#define ifr_intval ifr_ifru.ifru_intval
integer value

macroifr_kpi

#define ifr_kpi ifr_ifru.ifru_kpi

macroifr_wake_flags

#define ifr_wake_flags ifr_ifru.ifru_wake_flags
wake capabilities

macroifr_route_refcnt

#define ifr_route_refcnt ifr_ifru.ifru_route_refcnt
route references count

macroifr_reqcap

#define ifr_reqcap ifr_ifru.ifru_cap[0]
requested capabilities

macroifr_curcap

#define ifr_curcap ifr_ifru.ifru_cap[1]
current capabilities

macro_SIZEOF_ADDR_IFREQ

#define _SIZEOF_ADDR_IFREQ(ifr) ((ifr).ifr_addr.sa_len > sizeof (struct sockaddr) ?
	(sizeof (struct ifreq) - sizeof (struct sockaddr) +
	(ifr).ifr_addr.sa_len) : sizeof (struct ifreq))

structifaliasreq

size 64, align 1
char[16]ifra_nameif name, e.g. "en0"
struct sockaddrifra_addr
struct sockaddrifra_broadaddr
struct sockaddrifra_mask

structrslvmulti_req

size 16, align 8
struct sockaddr *sa
struct sockaddr **llsa

structifmediareq

size 44, align 4
char[16]ifm_nameif name, e.g. "en0"
intifm_currentcurrent media options
intifm_maskdon't care mask
intifm_statusmedia status
intifm_activeactive options
intifm_count# entries in ifm_ulist array
int *ifm_ulistmedia words

structifdrv

size 40, align 4
char[16]ifd_nameif name, e.g. "en0"
unsigned longifd_cmd
size_tifd_lenlength of ifd_data buffer
void *ifd_data

macroIFSTATMAX

#define IFSTATMAX 800
10 lines of text

structifstat

size 817, align 1
char[16]ifs_nameif name, e.g. "en0"
char[801]ascii

structifconf

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
intifc_lensize of associated buffer
unnamed union at net/if.h:421:2ifc_ifcu
caddr_tifcu_buf
struct ifreq *ifcu_req

macroifc_buf

#define ifc_buf ifc_ifcu.ifcu_buf
buffer address

macroifc_req

#define ifc_req ifc_ifcu.ifcu_req
array of structures returned

structkev_dl_proto_data

DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure
size 32, align 4
struct net_event_datalink_data
u_int32_tproto_family
u_int32_tproto_remaining_count

structif_nameindex

size 16, align 8
unsigned intif_index1, 2, ...
char *if_namenull terminated name: "le0", ...

functionif_nametoindex

unsigned int if_nametoindex(const char *)
man page · November 23, 2005
if_nametoindex(3) — provide mappings between interface names and indexes

functionif_indextoname

char *if_indextoname(unsigned int, char *)
man page · November 23, 2005
if_indextoname(3) — provide mappings between interface names and indexes

functionif_nameindex

struct if_nameindex *if_nameindex(void)
man page · November 23, 2005
if_nameindex(3) — provide mappings between interface names and indexes

functionif_freenameindex

void if_freenameindex(struct if_nameindex *)
man page · November 23, 2005
if_freenameindex(3) — provide mappings between interface names and indexes