17c478bd9Sstevel@tonic-gate /* 2*e11c3f44Smeem * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 37c478bd9Sstevel@tonic-gate * Use is subject to license terms. 47c478bd9Sstevel@tonic-gate */ 57c478bd9Sstevel@tonic-gate 67c478bd9Sstevel@tonic-gate /* 77c478bd9Sstevel@tonic-gate * Copyright (c) 1982, 1986 Regents of the University of California. 87c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 97c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 107c478bd9Sstevel@tonic-gate */ 117c478bd9Sstevel@tonic-gate 127c478bd9Sstevel@tonic-gate #ifndef _NET_IF_H 137c478bd9Sstevel@tonic-gate #define _NET_IF_H 147c478bd9Sstevel@tonic-gate 157c478bd9Sstevel@tonic-gate /* if.h 1.26 90/05/29 SMI; from UCB 7.1 6/4/86 */ 167c478bd9Sstevel@tonic-gate 177c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 187c478bd9Sstevel@tonic-gate 197c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) 207c478bd9Sstevel@tonic-gate #include <sys/socket.h> 217c478bd9Sstevel@tonic-gate #include <netinet/in.h> 227c478bd9Sstevel@tonic-gate #if defined(_LP64) 237c478bd9Sstevel@tonic-gate #include <sys/types32.h> 247c478bd9Sstevel@tonic-gate #endif 257c478bd9Sstevel@tonic-gate #endif 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifdef __cplusplus 287c478bd9Sstevel@tonic-gate extern "C" { 297c478bd9Sstevel@tonic-gate #endif 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate /* 327c478bd9Sstevel@tonic-gate * Structures defining a network interface, providing a packet 337c478bd9Sstevel@tonic-gate * transport mechanism (ala level 0 of the PUP protocols). 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * Each interface accepts output datagrams of a specified maximum 367c478bd9Sstevel@tonic-gate * length, and provides higher level routines with input datagrams 377c478bd9Sstevel@tonic-gate * received from its medium. 387c478bd9Sstevel@tonic-gate * 397c478bd9Sstevel@tonic-gate * Output occurs when the routine if_output is called, with three parameters: 407c478bd9Sstevel@tonic-gate * (*ifp->if_output)(ifp, m, dst) 417c478bd9Sstevel@tonic-gate * Here m is the mbuf chain to be sent and dst is the destination address. 427c478bd9Sstevel@tonic-gate * The output routine encapsulates the supplied datagram if necessary, 437c478bd9Sstevel@tonic-gate * and then transmits it on its medium. 447c478bd9Sstevel@tonic-gate * 457c478bd9Sstevel@tonic-gate * On input, each interface unwraps the data received by it, and either 467c478bd9Sstevel@tonic-gate * places it on the input queue of a internetwork datagram routine 477c478bd9Sstevel@tonic-gate * and posts the associated software interrupt, or passes the datagram to a raw 487c478bd9Sstevel@tonic-gate * packet input routine. 497c478bd9Sstevel@tonic-gate * 507c478bd9Sstevel@tonic-gate * Routines exist for locating interfaces by their addresses 517c478bd9Sstevel@tonic-gate * or for locating a interface on a certain network, as well as more general 527c478bd9Sstevel@tonic-gate * routing and gateway routines maintaining information used to locate 537c478bd9Sstevel@tonic-gate * interfaces. These routines live in the files if.c and route.c 547c478bd9Sstevel@tonic-gate */ 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * Structure defining a queue for a network interface. 607c478bd9Sstevel@tonic-gate * 617c478bd9Sstevel@tonic-gate * (Would like to call this struct ``if'', but C isn't PL/1.) 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate struct ifnet { 647c478bd9Sstevel@tonic-gate char *if_name; /* name, e.g. ``en'' or ``lo'' */ 657c478bd9Sstevel@tonic-gate short if_unit; /* sub-unit for lower level driver */ 667c478bd9Sstevel@tonic-gate short if_mtu; /* maximum transmission unit */ 677c478bd9Sstevel@tonic-gate short if_flags; /* up/down, broadcast, etc. */ 687c478bd9Sstevel@tonic-gate short if_timer; /* time 'til if_watchdog called */ 697c478bd9Sstevel@tonic-gate ushort_t if_promisc; /* net # of requests for promisc mode */ 707c478bd9Sstevel@tonic-gate int if_metric; /* routing metric (external only) */ 717c478bd9Sstevel@tonic-gate struct ifaddr *if_addrlist; /* linked list of addresses per if */ 727c478bd9Sstevel@tonic-gate struct ifqueue { 737c478bd9Sstevel@tonic-gate struct mbuf *ifq_head; 747c478bd9Sstevel@tonic-gate struct mbuf *ifq_tail; 757c478bd9Sstevel@tonic-gate int ifq_len; 767c478bd9Sstevel@tonic-gate int ifq_maxlen; 777c478bd9Sstevel@tonic-gate int ifq_drops; 787c478bd9Sstevel@tonic-gate } if_snd; /* output queue */ 797c478bd9Sstevel@tonic-gate /* procedure handles */ 807c478bd9Sstevel@tonic-gate int (*if_init)(); /* init routine */ 817c478bd9Sstevel@tonic-gate int (*if_output)(); /* output routine */ 827c478bd9Sstevel@tonic-gate int (*if_ioctl)(); /* ioctl routine */ 837c478bd9Sstevel@tonic-gate int (*if_reset)(); /* bus reset routine */ 847c478bd9Sstevel@tonic-gate int (*if_watchdog)(); /* timer routine */ 857c478bd9Sstevel@tonic-gate /* generic interface statistics */ 867c478bd9Sstevel@tonic-gate int if_ipackets; /* packets received on interface */ 877c478bd9Sstevel@tonic-gate int if_ierrors; /* input errors on interface */ 887c478bd9Sstevel@tonic-gate int if_opackets; /* packets sent on interface */ 897c478bd9Sstevel@tonic-gate int if_oerrors; /* output errors on interface */ 907c478bd9Sstevel@tonic-gate int if_collisions; /* collisions on csma interfaces */ 917c478bd9Sstevel@tonic-gate /* end statistics */ 927c478bd9Sstevel@tonic-gate struct ifnet *if_next; 937c478bd9Sstevel@tonic-gate struct ifnet *if_upper; /* next layer up */ 947c478bd9Sstevel@tonic-gate struct ifnet *if_lower; /* next layer down */ 957c478bd9Sstevel@tonic-gate int (*if_input)(); /* input routine */ 967c478bd9Sstevel@tonic-gate int (*if_ctlin)(); /* control input routine */ 977c478bd9Sstevel@tonic-gate int (*if_ctlout)(); /* control output routine */ 987c478bd9Sstevel@tonic-gate struct map *if_memmap; /* rmap for interface specific memory */ 997c478bd9Sstevel@tonic-gate }; 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate /* 1027c478bd9Sstevel@tonic-gate * NOTE : These flags are not directly used within IP. 1037c478bd9Sstevel@tonic-gate * ip_if.h has definitions derived from this which is used within IP. 1047c478bd9Sstevel@tonic-gate * If you define a flag here, you need to define one in ip_if.h before 1057c478bd9Sstevel@tonic-gate * using the new flag in IP. Don't use these flags directly in IP. 1067c478bd9Sstevel@tonic-gate */ 107*e11c3f44Smeem #define IFF_UP 0x0000000001 /* address is up */ 1087c478bd9Sstevel@tonic-gate #define IFF_BROADCAST 0x0000000002 /* broadcast address valid */ 1097c478bd9Sstevel@tonic-gate #define IFF_DEBUG 0x0000000004 /* turn on debugging */ 1107c478bd9Sstevel@tonic-gate #define IFF_LOOPBACK 0x0000000008 /* is a loopback net */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #define IFF_POINTOPOINT 0x0000000010 /* interface is point-to-point link */ 1137c478bd9Sstevel@tonic-gate #define IFF_NOTRAILERS 0x0000000020 /* avoid use of trailers */ 1147c478bd9Sstevel@tonic-gate #define IFF_RUNNING 0x0000000040 /* resources allocated */ 1157c478bd9Sstevel@tonic-gate #define IFF_NOARP 0x0000000080 /* no address resolution protocol */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #define IFF_PROMISC 0x0000000100 /* receive all packets */ 1187c478bd9Sstevel@tonic-gate #define IFF_ALLMULTI 0x0000000200 /* receive all multicast packets */ 1197c478bd9Sstevel@tonic-gate #define IFF_INTELLIGENT 0x0000000400 /* protocol code on board */ 1208df01f76Smeem /* 1218df01f76Smeem * The IFF_MULTICAST flag indicates that the network can support the 1228df01f76Smeem * transmission and reception of higher-level (e.g., IP) multicast packets. 1238df01f76Smeem * It is independent of hardware support for multicasting; for example, 1248df01f76Smeem * point-to-point links or pure broadcast networks may well support 1258df01f76Smeem * higher-level multicasts. 1268df01f76Smeem */ 1277c478bd9Sstevel@tonic-gate #define IFF_MULTICAST 0x0000000800 /* supports multicast */ 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate #define IFF_MULTI_BCAST 0x0000001000 /* multicast using broadcast address */ 1307c478bd9Sstevel@tonic-gate #define IFF_UNNUMBERED 0x0000002000 /* non-unique address */ 1317c478bd9Sstevel@tonic-gate #define IFF_DHCPRUNNING 0x0000004000 /* DHCP controls this interface */ 1327c478bd9Sstevel@tonic-gate #define IFF_PRIVATE 0x0000008000 /* do not advertise */ 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate /* 1357c478bd9Sstevel@tonic-gate * The following flags can't be grabbed or altered by SIOC[GS]IFFLAGS. 1367c478bd9Sstevel@tonic-gate * Should use SIOC[GS]LIFFLAGS which has a larger flags field. 1377c478bd9Sstevel@tonic-gate */ 1387c478bd9Sstevel@tonic-gate #define IFF_NOXMIT 0x0000010000 /* Do not transmit packets */ 1397c478bd9Sstevel@tonic-gate #define IFF_NOLOCAL 0x0000020000 /* No address - just on-link subnet */ 140*e11c3f44Smeem #define IFF_DEPRECATED 0x0000040000 /* Address is deprecated */ 1417c478bd9Sstevel@tonic-gate #define IFF_ADDRCONF 0x0000080000 /* address from stateless addrconf */ 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate #define IFF_ROUTER 0x0000100000 /* router on this interface */ 1447c478bd9Sstevel@tonic-gate #define IFF_NONUD 0x0000200000 /* No NUD on this interface */ 1457c478bd9Sstevel@tonic-gate #define IFF_ANYCAST 0x0000400000 /* Anycast address */ 1467c478bd9Sstevel@tonic-gate #define IFF_NORTEXCH 0x0000800000 /* Do not exchange routing info */ 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate #define IFF_IPV4 0x0001000000 /* IPv4 interface */ 1497c478bd9Sstevel@tonic-gate #define IFF_IPV6 0x0002000000 /* IPv6 interface */ 1505c0b7edeSseb /* 0x0004000000 was IFF_MIPRUNNING */ 151*e11c3f44Smeem #define IFF_NOFAILOVER 0x0008000000 /* in.mpathd(1M) test address */ 1527c478bd9Sstevel@tonic-gate 153*e11c3f44Smeem #define IFF_FAILED 0x0010000000 /* Interface has failed */ 154*e11c3f44Smeem #define IFF_STANDBY 0x0020000000 /* Interface is a hot-spare */ 155*e11c3f44Smeem #define IFF_INACTIVE 0x0040000000 /* Functioning but not used for data */ 156*e11c3f44Smeem #define IFF_OFFLINE 0x0080000000 /* Interface is offline */ 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate /* 1597c478bd9Sstevel@tonic-gate * The IFF_XRESOLV flag is an evolving interface and is subject 1607c478bd9Sstevel@tonic-gate * to change without notice. 1617c478bd9Sstevel@tonic-gate */ 162aee32e3dScarlsonj #define IFF_XRESOLV 0x0100000000ll /* IPv6 external resolver */ 163aee32e3dScarlsonj #define IFF_COS_ENABLED 0x0200000000ll /* If interface supports CoS marking */ 164aee32e3dScarlsonj #define IFF_PREFERRED 0x0400000000ll /* Prefer as source address */ 165aee32e3dScarlsonj #define IFF_TEMPORARY 0x0800000000ll /* RFC3041 */ 1667c478bd9Sstevel@tonic-gate 167aee32e3dScarlsonj #define IFF_FIXEDMTU 0x1000000000ll /* MTU manually set with SIOCSLIFMTU */ 168aee32e3dScarlsonj #define IFF_VIRTUAL 0x2000000000ll /* Does not send or receive packets */ 16969bb4bb4Scarlsonj #define IFF_DUPLICATE 0x4000000000ll /* Local address already in use */ 170*e11c3f44Smeem #define IFF_IPMP 0x8000000000ll /* IPMP IP interface */ 1717c478bd9Sstevel@tonic-gate 172*e11c3f44Smeem /* flags that cannot be changed by userland on any interface */ 1737c478bd9Sstevel@tonic-gate #define IFF_CANTCHANGE \ 1747c478bd9Sstevel@tonic-gate (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING | IFF_PROMISC | \ 1757c478bd9Sstevel@tonic-gate IFF_MULTICAST | IFF_MULTI_BCAST | IFF_UNNUMBERED | IFF_IPV4 | \ 176*e11c3f44Smeem IFF_IPV6 | IFF_IPMP | IFF_FIXEDMTU | IFF_VIRTUAL | \ 1771d19ca10Svi IFF_LOOPBACK | IFF_ALLMULTI | IFF_DUPLICATE | IFF_COS_ENABLED) 1787c478bd9Sstevel@tonic-gate 179*e11c3f44Smeem /* flags that cannot be changed by userland on an IPMP interface */ 180*e11c3f44Smeem #define IFF_IPMP_CANTCHANGE IFF_FAILED 181*e11c3f44Smeem 182*e11c3f44Smeem /* flags that can never be set on an IPMP interface */ 183*e11c3f44Smeem #define IFF_IPMP_INVALID (IFF_STANDBY | IFF_INACTIVE | IFF_OFFLINE | \ 184*e11c3f44Smeem IFF_NOFAILOVER | IFF_NOARP | IFF_NONUD | IFF_XRESOLV) 185*e11c3f44Smeem 1867c478bd9Sstevel@tonic-gate /* 1877c478bd9Sstevel@tonic-gate * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) 1887c478bd9Sstevel@tonic-gate * input routines have queues of messages stored on ifqueue structures 1897c478bd9Sstevel@tonic-gate * (defined above). Entries are added to and deleted from these structures 1907c478bd9Sstevel@tonic-gate * by these macros, which should be called with ipl raised to splimp(). 1917c478bd9Sstevel@tonic-gate */ 1927c478bd9Sstevel@tonic-gate #define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) 1937c478bd9Sstevel@tonic-gate #define IF_DROP(ifq) ((ifq)->ifq_drops++) 1947c478bd9Sstevel@tonic-gate #define IF_ENQUEUE(ifq, m) { \ 1957c478bd9Sstevel@tonic-gate (m)->m_act = 0; \ 1967c478bd9Sstevel@tonic-gate if ((ifq)->ifq_tail == 0) \ 1977c478bd9Sstevel@tonic-gate (ifq)->ifq_head = m; \ 1987c478bd9Sstevel@tonic-gate else \ 1997c478bd9Sstevel@tonic-gate (ifq)->ifq_tail->m_act = m; \ 2007c478bd9Sstevel@tonic-gate (ifq)->ifq_tail = m; \ 2017c478bd9Sstevel@tonic-gate (ifq)->ifq_len++; \ 2027c478bd9Sstevel@tonic-gate } 2037c478bd9Sstevel@tonic-gate #define IF_PREPEND(ifq, m) { \ 2047c478bd9Sstevel@tonic-gate (m)->m_act = (ifq)->ifq_head; \ 2057c478bd9Sstevel@tonic-gate if ((ifq)->ifq_tail == 0) \ 2067c478bd9Sstevel@tonic-gate (ifq)->ifq_tail = (m); \ 2077c478bd9Sstevel@tonic-gate (ifq)->ifq_head = (m); \ 2087c478bd9Sstevel@tonic-gate (ifq)->ifq_len++; \ 2097c478bd9Sstevel@tonic-gate } 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* 2127c478bd9Sstevel@tonic-gate * Packets destined for level-1 protocol input routines 2137c478bd9Sstevel@tonic-gate * have a pointer to the receiving interface prepended to the data. 2147c478bd9Sstevel@tonic-gate * IF_DEQUEUEIF extracts and returns this pointer when dequeuing the packet. 2157c478bd9Sstevel@tonic-gate * IF_ADJ should be used otherwise to adjust for its presence. 2167c478bd9Sstevel@tonic-gate */ 2177c478bd9Sstevel@tonic-gate #define IF_ADJ(m) { \ 2187c478bd9Sstevel@tonic-gate (m)->m_off += sizeof (struct ifnet *); \ 2197c478bd9Sstevel@tonic-gate (m)->m_len -= sizeof (struct ifnet *); \ 2207c478bd9Sstevel@tonic-gate if ((m)->m_len == 0) { \ 2217c478bd9Sstevel@tonic-gate struct mbuf *n; \ 2227c478bd9Sstevel@tonic-gate MFREE((m), n); \ 2237c478bd9Sstevel@tonic-gate (m) = n; \ 2247c478bd9Sstevel@tonic-gate } \ 2257c478bd9Sstevel@tonic-gate } 2267c478bd9Sstevel@tonic-gate #define IF_DEQUEUEIF(ifq, m, ifp) { \ 2277c478bd9Sstevel@tonic-gate (m) = (ifq)->ifq_head; \ 2287c478bd9Sstevel@tonic-gate if (m) { \ 2297c478bd9Sstevel@tonic-gate if (((ifq)->ifq_head = (m)->m_act) == 0) \ 2307c478bd9Sstevel@tonic-gate (ifq)->ifq_tail = 0; \ 2317c478bd9Sstevel@tonic-gate (m)->m_act = 0; \ 2327c478bd9Sstevel@tonic-gate (ifq)->ifq_len--; \ 2337c478bd9Sstevel@tonic-gate (ifp) = *(mtod((m), struct ifnet **)); \ 2347c478bd9Sstevel@tonic-gate IF_ADJ(m); \ 2357c478bd9Sstevel@tonic-gate } \ 2367c478bd9Sstevel@tonic-gate } 2377c478bd9Sstevel@tonic-gate #define IF_DEQUEUE(ifq, m) { \ 2387c478bd9Sstevel@tonic-gate (m) = (ifq)->ifq_head; \ 2397c478bd9Sstevel@tonic-gate if (m) { \ 2407c478bd9Sstevel@tonic-gate if (((ifq)->ifq_head = (m)->m_act) == 0) \ 2417c478bd9Sstevel@tonic-gate (ifq)->ifq_tail = 0; \ 2427c478bd9Sstevel@tonic-gate (m)->m_act = 0; \ 2437c478bd9Sstevel@tonic-gate (ifq)->ifq_len--; \ 2447c478bd9Sstevel@tonic-gate } \ 2457c478bd9Sstevel@tonic-gate } 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate #define IFQ_MAXLEN 50 2487c478bd9Sstevel@tonic-gate #define IFNET_SLOWHZ 1 /* granularity is 1 second */ 2497c478bd9Sstevel@tonic-gate 2507c478bd9Sstevel@tonic-gate /* 2517c478bd9Sstevel@tonic-gate * The ifaddr structure contains information about one address 2527c478bd9Sstevel@tonic-gate * of an interface. They are maintained by the different address families, 2537c478bd9Sstevel@tonic-gate * are allocated and attached when an address is set, and are linked 2547c478bd9Sstevel@tonic-gate * together so all addresses for an interface can be located. 2557c478bd9Sstevel@tonic-gate */ 2567c478bd9Sstevel@tonic-gate struct ifaddr { 2577c478bd9Sstevel@tonic-gate struct sockaddr ifa_addr; /* address of interface */ 2587c478bd9Sstevel@tonic-gate union { 2597c478bd9Sstevel@tonic-gate struct sockaddr ifu_broadaddr; 2607c478bd9Sstevel@tonic-gate struct sockaddr ifu_dstaddr; 2617c478bd9Sstevel@tonic-gate } ifa_ifu; 2627c478bd9Sstevel@tonic-gate #define ifa_broadaddr ifa_ifu.ifu_broadaddr /* broadcast address */ 2637c478bd9Sstevel@tonic-gate #define ifa_dstaddr ifa_ifu.ifu_dstaddr /* other end of p-to-p link */ 2647c478bd9Sstevel@tonic-gate struct ifnet *ifa_ifp; /* back-pointer to interface */ 2657c478bd9Sstevel@tonic-gate struct ifaddr *ifa_next; /* next address for interface */ 2667c478bd9Sstevel@tonic-gate }; 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate /* 2697c478bd9Sstevel@tonic-gate * For SIOCLIF*ND ioctls. 2707c478bd9Sstevel@tonic-gate * 2717c478bd9Sstevel@tonic-gate * The lnr_state_* fields use the ND_* neighbor reachability states. 2727c478bd9Sstevel@tonic-gate * The 3 different fields are for use with SIOCLIFSETND to cover the cases 2737c478bd9Sstevel@tonic-gate * when 2747c478bd9Sstevel@tonic-gate * A new entry is created 2757c478bd9Sstevel@tonic-gate * The entry already exists and the link-layer address is the same 2767c478bd9Sstevel@tonic-gate * The entry already exists and the link-layer address differs 2777c478bd9Sstevel@tonic-gate * 2787c478bd9Sstevel@tonic-gate * Use ND_UNCHANGED and ND_ISROUTER_UNCHANGED to not change any state. 2797c478bd9Sstevel@tonic-gate */ 2807c478bd9Sstevel@tonic-gate #define ND_MAX_HDW_LEN 64 2817c478bd9Sstevel@tonic-gate typedef struct lif_nd_req { 2827c478bd9Sstevel@tonic-gate struct sockaddr_storage lnr_addr; 2837c478bd9Sstevel@tonic-gate uint8_t lnr_state_create; /* When creating */ 2847c478bd9Sstevel@tonic-gate uint8_t lnr_state_same_lla; /* Update same addr */ 2857c478bd9Sstevel@tonic-gate uint8_t lnr_state_diff_lla; /* Update w/ diff. */ 2867c478bd9Sstevel@tonic-gate int lnr_hdw_len; 2877c478bd9Sstevel@tonic-gate int lnr_flags; /* See below */ 2887c478bd9Sstevel@tonic-gate /* padding because ia32 "long long"s are only 4-byte aligned. */ 2897c478bd9Sstevel@tonic-gate int lnr_pad0; 2907c478bd9Sstevel@tonic-gate char lnr_hdw_addr[ND_MAX_HDW_LEN]; 2917c478bd9Sstevel@tonic-gate } lif_nd_req_t; 2927c478bd9Sstevel@tonic-gate 2937c478bd9Sstevel@tonic-gate /* 2947c478bd9Sstevel@tonic-gate * Neighbor reachability states 2957c478bd9Sstevel@tonic-gate * Used with SIOCLIF*ND ioctls. 2967c478bd9Sstevel@tonic-gate */ 2977c478bd9Sstevel@tonic-gate #define ND_UNCHANGED 0 /* For ioctls that don't modify state */ 2987c478bd9Sstevel@tonic-gate #define ND_INCOMPLETE 1 /* addr resolution in progress */ 2997c478bd9Sstevel@tonic-gate #define ND_REACHABLE 2 /* have recently been reachable */ 3007c478bd9Sstevel@tonic-gate #define ND_STALE 3 /* may be unreachable, don't do anything */ 3017c478bd9Sstevel@tonic-gate #define ND_DELAY 4 /* wait for upper layer hint */ 3027c478bd9Sstevel@tonic-gate #define ND_PROBE 5 /* send probes */ 3037c478bd9Sstevel@tonic-gate #define ND_UNREACHABLE 6 /* delete this route */ 304c793af95Ssangeeta #define ND_INITIAL 7 /* ipv4: arp resolution has not been sent yet */ 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate #define ND_STATE_VALID_MIN 0 307c793af95Ssangeeta #define ND_STATE_VALID_MAX 7 3087c478bd9Sstevel@tonic-gate 3097c478bd9Sstevel@tonic-gate /* 3107c478bd9Sstevel@tonic-gate * lnr_flags value of lif_nd_req. 3117c478bd9Sstevel@tonic-gate * Used with SIOCLIF*ND ioctls. 3127c478bd9Sstevel@tonic-gate */ 3137c478bd9Sstevel@tonic-gate #define NDF_ISROUTER_ON 0x1 3147c478bd9Sstevel@tonic-gate #define NDF_ISROUTER_OFF 0x2 3157c478bd9Sstevel@tonic-gate #define NDF_ANYCAST_ON 0x4 3167c478bd9Sstevel@tonic-gate #define NDF_ANYCAST_OFF 0x8 3177c478bd9Sstevel@tonic-gate #define NDF_PROXY_ON 0x10 3187c478bd9Sstevel@tonic-gate #define NDF_PROXY_OFF 0x20 3197c478bd9Sstevel@tonic-gate 3207c478bd9Sstevel@tonic-gate /* For SIOC[GS]LIFLNKINFO */ 3217c478bd9Sstevel@tonic-gate typedef struct lif_ifinfo_req { 3227c478bd9Sstevel@tonic-gate uint8_t lir_maxhops; 3237c478bd9Sstevel@tonic-gate uint32_t lir_reachtime; /* Reachable time in msec */ 3247c478bd9Sstevel@tonic-gate uint32_t lir_reachretrans; /* Retransmission timer msec */ 3257c478bd9Sstevel@tonic-gate uint32_t lir_maxmtu; 3267c478bd9Sstevel@tonic-gate } lif_ifinfo_req_t; 3277c478bd9Sstevel@tonic-gate 3287c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate /* 3317c478bd9Sstevel@tonic-gate * Maximum lengths of interface name and IPMP group name; these are the same 3327c478bd9Sstevel@tonic-gate * for historical reasons. Note that the actual maximum length of a name is 3337c478bd9Sstevel@tonic-gate * one byte less than these constants since the kernel always sets the final 3347c478bd9Sstevel@tonic-gate * byte of lifr_name and lifr_groupname to NUL. 3357c478bd9Sstevel@tonic-gate */ 3367c478bd9Sstevel@tonic-gate #define _LIFNAMSIZ 32 3377c478bd9Sstevel@tonic-gate 3387c478bd9Sstevel@tonic-gate #if !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) 3397c478bd9Sstevel@tonic-gate 3407c478bd9Sstevel@tonic-gate #define LIFNAMSIZ _LIFNAMSIZ 3417c478bd9Sstevel@tonic-gate #define LIFGRNAMSIZ LIFNAMSIZ 3427c478bd9Sstevel@tonic-gate 3437c478bd9Sstevel@tonic-gate /* 3447c478bd9Sstevel@tonic-gate * Interface request structure used for socket 3457c478bd9Sstevel@tonic-gate * ioctl's. All interface ioctl's must have parameter 3467c478bd9Sstevel@tonic-gate * definitions which begin with ifr_name. The 3477c478bd9Sstevel@tonic-gate * remainder may be interface specific. 3487c478bd9Sstevel@tonic-gate * Note: This data structure uses 64bit type uint64_t which is not 3497c478bd9Sstevel@tonic-gate * a valid type for strict ANSI/ISO C compilation for ILP32. 3507c478bd9Sstevel@tonic-gate * Applications with ioctls using this structure that insist on 3517c478bd9Sstevel@tonic-gate * building with strict ANSI/ISO C (-Xc) will need to be LP64. 3527c478bd9Sstevel@tonic-gate */ 3537c478bd9Sstevel@tonic-gate #if defined(_INT64_TYPE) 3547c478bd9Sstevel@tonic-gate struct lifreq { 3557c478bd9Sstevel@tonic-gate char lifr_name[LIFNAMSIZ]; /* if name, e.g. "en0" */ 3567c478bd9Sstevel@tonic-gate union { 3577c478bd9Sstevel@tonic-gate int lifru_addrlen; /* for subnet/token etc */ 3587c478bd9Sstevel@tonic-gate uint_t lifru_ppa; /* SIOCSLIFNAME */ 3597c478bd9Sstevel@tonic-gate } lifr_lifru1; 3607c478bd9Sstevel@tonic-gate #define lifr_addrlen lifr_lifru1.lifru_addrlen 3617c478bd9Sstevel@tonic-gate #define lifr_ppa lifr_lifru1.lifru_ppa /* Driver's ppa */ 362*e11c3f44Smeem uint_t lifr_type; /* IFT_ETHER, ... */ 3637c478bd9Sstevel@tonic-gate union { 3647c478bd9Sstevel@tonic-gate struct sockaddr_storage lifru_addr; 3657c478bd9Sstevel@tonic-gate struct sockaddr_storage lifru_dstaddr; 3667c478bd9Sstevel@tonic-gate struct sockaddr_storage lifru_broadaddr; 3677c478bd9Sstevel@tonic-gate struct sockaddr_storage lifru_token; /* With lifr_addrlen */ 3687c478bd9Sstevel@tonic-gate struct sockaddr_storage lifru_subnet; /* With lifr_addrlen */ 3697c478bd9Sstevel@tonic-gate int lifru_index; /* interface index */ 3707c478bd9Sstevel@tonic-gate uint64_t lifru_flags; /* Flags for SIOC?LIFFLAGS */ 3717c478bd9Sstevel@tonic-gate int lifru_metric; 3727c478bd9Sstevel@tonic-gate uint_t lifru_mtu; 3737c478bd9Sstevel@tonic-gate char lifru_data[1]; /* interface dependent data */ 3747c478bd9Sstevel@tonic-gate char lifru_enaddr[6]; 3757c478bd9Sstevel@tonic-gate int lif_muxid[2]; /* mux id's for arp and ip */ 3767c478bd9Sstevel@tonic-gate struct lif_nd_req lifru_nd_req; 3777c478bd9Sstevel@tonic-gate struct lif_ifinfo_req lifru_ifinfo_req; 3787c478bd9Sstevel@tonic-gate char lifru_groupname[LIFGRNAMSIZ]; /* SIOC[GS]LIFGROUPNAME */ 379*e11c3f44Smeem char lifru_binding[LIFNAMSIZ]; /* SIOCGLIFBINDING */ 3807c478bd9Sstevel@tonic-gate uint_t lifru_delay; /* SIOC[GS]LIFNOTIFYDELAY */ 3817c478bd9Sstevel@tonic-gate zoneid_t lifru_zoneid; /* SIOC[GS]LIFZONE */ 3827c478bd9Sstevel@tonic-gate } lifr_lifru; 3837c478bd9Sstevel@tonic-gate 3847c478bd9Sstevel@tonic-gate #define lifr_addr lifr_lifru.lifru_addr /* address */ 3857c478bd9Sstevel@tonic-gate #define lifr_dstaddr lifr_lifru.lifru_dstaddr /* other end of p-to-p link */ 3867c478bd9Sstevel@tonic-gate #define lifr_broadaddr lifr_lifru.lifru_broadaddr /* broadcast address */ 3877c478bd9Sstevel@tonic-gate #define lifr_token lifr_lifru.lifru_token /* address token */ 3887c478bd9Sstevel@tonic-gate #define lifr_subnet lifr_lifru.lifru_subnet /* subnet prefix */ 3897c478bd9Sstevel@tonic-gate #define lifr_index lifr_lifru.lifru_index /* interface index */ 3907c478bd9Sstevel@tonic-gate #define lifr_flags lifr_lifru.lifru_flags /* flags */ 3917c478bd9Sstevel@tonic-gate #define lifr_metric lifr_lifru.lifru_metric /* metric */ 3927c478bd9Sstevel@tonic-gate #define lifr_mtu lifr_lifru.lifru_mtu /* mtu */ 3937c478bd9Sstevel@tonic-gate #define lifr_data lifr_lifru.lifru_data /* for use by interface */ 3947c478bd9Sstevel@tonic-gate #define lifr_enaddr lifr_lifru.lifru_enaddr /* ethernet address */ 3957c478bd9Sstevel@tonic-gate #define lifr_index lifr_lifru.lifru_index /* interface index */ 3967c478bd9Sstevel@tonic-gate #define lifr_ip_muxid lifr_lifru.lif_muxid[0] 3977c478bd9Sstevel@tonic-gate #define lifr_arp_muxid lifr_lifru.lif_muxid[1] 3987c478bd9Sstevel@tonic-gate #define lifr_nd lifr_lifru.lifru_nd_req /* SIOCLIF*ND */ 3997c478bd9Sstevel@tonic-gate #define lifr_ifinfo lifr_lifru.lifru_ifinfo_req /* SIOC[GS]LIFLNKINFO */ 4007c478bd9Sstevel@tonic-gate #define lifr_groupname lifr_lifru.lifru_groupname 401*e11c3f44Smeem #define lifr_binding lifr_lifru.lifru_binding 4027c478bd9Sstevel@tonic-gate #define lifr_delay lifr_lifru.lifru_delay 4037c478bd9Sstevel@tonic-gate #define lifr_zoneid lifr_lifru.lifru_zoneid 4047c478bd9Sstevel@tonic-gate }; 4057c478bd9Sstevel@tonic-gate #endif /* defined(_INT64_TYPE) */ 4067c478bd9Sstevel@tonic-gate 4077c478bd9Sstevel@tonic-gate /* 4087c478bd9Sstevel@tonic-gate * Argument structure for SIOCT* address testing ioctls. 4097c478bd9Sstevel@tonic-gate */ 4107c478bd9Sstevel@tonic-gate struct sioc_addrreq { 4117c478bd9Sstevel@tonic-gate struct sockaddr_storage sa_addr; /* Address to test */ 4127c478bd9Sstevel@tonic-gate int sa_res; /* Result - 0/1 */ 4137c478bd9Sstevel@tonic-gate int sa_pad; 4147c478bd9Sstevel@tonic-gate }; 4157c478bd9Sstevel@tonic-gate 4167c478bd9Sstevel@tonic-gate /* 4177c478bd9Sstevel@tonic-gate * Argument structure used by mrouted to get src-grp pkt counts using 4187c478bd9Sstevel@tonic-gate * SIOCGETLSGCNT. See <netinet/ip_mroute.h>. 4197c478bd9Sstevel@tonic-gate */ 4207c478bd9Sstevel@tonic-gate struct sioc_lsg_req { 4217c478bd9Sstevel@tonic-gate struct sockaddr_storage slr_src; 4227c478bd9Sstevel@tonic-gate struct sockaddr_storage slr_grp; 4237c478bd9Sstevel@tonic-gate uint_t slr_pktcnt; 4247c478bd9Sstevel@tonic-gate uint_t slr_bytecnt; 4257c478bd9Sstevel@tonic-gate uint_t slr_wrong_if; 4267c478bd9Sstevel@tonic-gate uint_t slr_pad; 4277c478bd9Sstevel@tonic-gate }; 4287c478bd9Sstevel@tonic-gate 4297c478bd9Sstevel@tonic-gate /* 4307c478bd9Sstevel@tonic-gate * OBSOLETE: Replaced by struct lifreq. Supported for compatibility. 4317c478bd9Sstevel@tonic-gate * 4327c478bd9Sstevel@tonic-gate * Interface request structure used for socket 4337c478bd9Sstevel@tonic-gate * ioctl's. All interface ioctl's must have parameter 4347c478bd9Sstevel@tonic-gate * definitions which begin with ifr_name. The 4357c478bd9Sstevel@tonic-gate * remainder may be interface specific. 4367c478bd9Sstevel@tonic-gate */ 4377c478bd9Sstevel@tonic-gate struct ifreq { 4387c478bd9Sstevel@tonic-gate #define IFNAMSIZ 16 4397c478bd9Sstevel@tonic-gate char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 4407c478bd9Sstevel@tonic-gate union { 4417c478bd9Sstevel@tonic-gate struct sockaddr ifru_addr; 4427c478bd9Sstevel@tonic-gate struct sockaddr ifru_dstaddr; 4437c478bd9Sstevel@tonic-gate char ifru_oname[IFNAMSIZ]; /* other if name */ 4447c478bd9Sstevel@tonic-gate struct sockaddr ifru_broadaddr; 4457c478bd9Sstevel@tonic-gate int ifru_index; /* interface index */ 4467c478bd9Sstevel@tonic-gate short ifru_flags; 4477c478bd9Sstevel@tonic-gate int ifru_metric; 4487c478bd9Sstevel@tonic-gate char ifru_data[1]; /* interface dependent data */ 4497c478bd9Sstevel@tonic-gate char ifru_enaddr[6]; 4507c478bd9Sstevel@tonic-gate int if_muxid[2]; /* mux id's for arp and ip */ 4517c478bd9Sstevel@tonic-gate 4527c478bd9Sstevel@tonic-gate /* Struct for flags/ppa */ 4537c478bd9Sstevel@tonic-gate struct ifr_ppaflags { 4547c478bd9Sstevel@tonic-gate short ifrup_flags; /* Space of ifru_flags. */ 4557c478bd9Sstevel@tonic-gate short ifrup_filler; 4567c478bd9Sstevel@tonic-gate uint_t ifrup_ppa; 4577c478bd9Sstevel@tonic-gate } ifru_ppaflags; 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate /* Struct for FDDI ioctl's */ 4607c478bd9Sstevel@tonic-gate struct ifr_dnld_reqs { 4617c478bd9Sstevel@tonic-gate uint32_t v_addr; 4627c478bd9Sstevel@tonic-gate uint32_t m_addr; 4637c478bd9Sstevel@tonic-gate uint32_t ex_addr; 4647c478bd9Sstevel@tonic-gate uint32_t size; 4657c478bd9Sstevel@tonic-gate } ifru_dnld_req; 4667c478bd9Sstevel@tonic-gate 4677c478bd9Sstevel@tonic-gate /* Struct for FDDI stats */ 4687c478bd9Sstevel@tonic-gate struct ifr_fddi_stats { 4697c478bd9Sstevel@tonic-gate uint32_t stat_size; 4707c478bd9Sstevel@tonic-gate uint32_t fddi_stats; 4717c478bd9Sstevel@tonic-gate } ifru_fddi_stat; 4727c478bd9Sstevel@tonic-gate 4737c478bd9Sstevel@tonic-gate struct ifr_netmapents { 4747c478bd9Sstevel@tonic-gate uint32_t map_ent_size, /* size of netmap structure */ 4757c478bd9Sstevel@tonic-gate entry_number; /* index into netmap list */ 4767c478bd9Sstevel@tonic-gate uint32_t fddi_map_ent; /* pointer to user structure */ 4777c478bd9Sstevel@tonic-gate } ifru_netmapent; 4787c478bd9Sstevel@tonic-gate 4797c478bd9Sstevel@tonic-gate /* Field for generic ioctl for fddi */ 4807c478bd9Sstevel@tonic-gate 4817c478bd9Sstevel@tonic-gate struct ifr_fddi_gen_struct { 4827c478bd9Sstevel@tonic-gate uint32_t ifru_fddi_gioctl; /* field for gen ioctl */ 4837c478bd9Sstevel@tonic-gate uint32_t ifru_fddi_gaddr; /* Generic ptr to a field */ 4847c478bd9Sstevel@tonic-gate } ifru_fddi_gstruct; 4857c478bd9Sstevel@tonic-gate 4867c478bd9Sstevel@tonic-gate } ifr_ifru; 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate #define ifr_addr ifr_ifru.ifru_addr /* address */ 4897c478bd9Sstevel@tonic-gate #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ 4907c478bd9Sstevel@tonic-gate #define ifr_oname ifr_ifru.ifru_oname /* other if name */ 4917c478bd9Sstevel@tonic-gate #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ 4927c478bd9Sstevel@tonic-gate #define ifr_flags ifr_ifru.ifru_flags /* flags */ 4937c478bd9Sstevel@tonic-gate #define ifr_metric ifr_ifru.ifru_metric /* metric */ 4947c478bd9Sstevel@tonic-gate #define ifr_data ifr_ifru.ifru_data /* for use by interface */ 4957c478bd9Sstevel@tonic-gate #define ifr_enaddr ifr_ifru.ifru_enaddr /* ethernet address */ 4967c478bd9Sstevel@tonic-gate #define ifr_index ifr_ifru.ifru_index /* interface index */ 4977c478bd9Sstevel@tonic-gate /* For setting ppa */ 4987c478bd9Sstevel@tonic-gate #define ifr_ppa ifr_ifru.ifru_ppaflags.ifrup_ppa 4997c478bd9Sstevel@tonic-gate 5007c478bd9Sstevel@tonic-gate /* FDDI specific */ 5017c478bd9Sstevel@tonic-gate #define ifr_dnld_req ifr_ifru.ifru_dnld_req 5027c478bd9Sstevel@tonic-gate #define ifr_fddi_stat ifr_ifru.ifru_fddi_stat 5037c478bd9Sstevel@tonic-gate #define ifr_fddi_netmap ifr_ifru.ifru_netmapent /* FDDI network map entries */ 5047c478bd9Sstevel@tonic-gate #define ifr_fddi_gstruct ifr_ifru.ifru_fddi_gstruct 5057c478bd9Sstevel@tonic-gate 5067c478bd9Sstevel@tonic-gate #define ifr_ip_muxid ifr_ifru.if_muxid[0] 5077c478bd9Sstevel@tonic-gate #define ifr_arp_muxid ifr_ifru.if_muxid[1] 5087c478bd9Sstevel@tonic-gate }; 5097c478bd9Sstevel@tonic-gate 5107c478bd9Sstevel@tonic-gate /* Used by SIOCGLIFNUM. Uses same flags as in struct lifconf */ 5117c478bd9Sstevel@tonic-gate struct lifnum { 5127c478bd9Sstevel@tonic-gate sa_family_t lifn_family; 5137c478bd9Sstevel@tonic-gate int lifn_flags; /* request specific interfaces */ 5147c478bd9Sstevel@tonic-gate int lifn_count; /* Result */ 5157c478bd9Sstevel@tonic-gate }; 5167c478bd9Sstevel@tonic-gate 5177c478bd9Sstevel@tonic-gate /* 5187c478bd9Sstevel@tonic-gate * Structure used in SIOCGLIFCONF request. 5197c478bd9Sstevel@tonic-gate * Used to retrieve interface configuration 5207c478bd9Sstevel@tonic-gate * for machine (useful for programs which 5217c478bd9Sstevel@tonic-gate * must know all networks accessible) for a given address family. 5227c478bd9Sstevel@tonic-gate * Using AF_UNSPEC will retrieve all address families. 5237c478bd9Sstevel@tonic-gate */ 5247c478bd9Sstevel@tonic-gate struct lifconf { 5257c478bd9Sstevel@tonic-gate sa_family_t lifc_family; 5267c478bd9Sstevel@tonic-gate int lifc_flags; /* request specific interfaces */ 5277c478bd9Sstevel@tonic-gate int lifc_len; /* size of associated buffer */ 5287c478bd9Sstevel@tonic-gate union { 5297c478bd9Sstevel@tonic-gate caddr_t lifcu_buf; 5307c478bd9Sstevel@tonic-gate struct lifreq *lifcu_req; 5317c478bd9Sstevel@tonic-gate } lifc_lifcu; 5327c478bd9Sstevel@tonic-gate #define lifc_buf lifc_lifcu.lifcu_buf /* buffer address */ 5337c478bd9Sstevel@tonic-gate #define lifc_req lifc_lifcu.lifcu_req /* array of structures returned */ 5347c478bd9Sstevel@tonic-gate }; 5357c478bd9Sstevel@tonic-gate 5367c478bd9Sstevel@tonic-gate /* 5377c478bd9Sstevel@tonic-gate * Structure used in SIOCGLIFSRCOF to get the interface 5387c478bd9Sstevel@tonic-gate * configuration list for those interfaces that use an address 5397c478bd9Sstevel@tonic-gate * hosted on the interface (set in lifs_ifindex), as the source 5407c478bd9Sstevel@tonic-gate * address. 5417c478bd9Sstevel@tonic-gate */ 5427c478bd9Sstevel@tonic-gate struct lifsrcof { 5437c478bd9Sstevel@tonic-gate uint_t lifs_ifindex; /* interface of interest */ 5447c478bd9Sstevel@tonic-gate size_t lifs_maxlen; /* size of buffer: input */ 5457c478bd9Sstevel@tonic-gate size_t lifs_len; /* size of buffer: output */ 5467c478bd9Sstevel@tonic-gate union { 5477c478bd9Sstevel@tonic-gate caddr_t lifsu_buf; 5487c478bd9Sstevel@tonic-gate struct lifreq *lifsu_req; 5497c478bd9Sstevel@tonic-gate } lifs_lifsu; 5507c478bd9Sstevel@tonic-gate #define lifs_buf lifs_lifsu.lifsu_buf /* buffer address */ 5517c478bd9Sstevel@tonic-gate #define lifs_req lifs_lifsu.lifsu_req /* array returned */ 5527c478bd9Sstevel@tonic-gate }; 5537c478bd9Sstevel@tonic-gate 5547c478bd9Sstevel@tonic-gate /* Flags */ 5557c478bd9Sstevel@tonic-gate #define LIFC_NOXMIT 0x01 /* Include IFF_NOXMIT interfaces */ 5567c478bd9Sstevel@tonic-gate #define LIFC_EXTERNAL_SOURCE 0x02 /* Exclude the interfaces which can't */ 5577c478bd9Sstevel@tonic-gate /* be used to communicate outside the */ 5587c478bd9Sstevel@tonic-gate /* node (exclude interfaces which are */ 5597c478bd9Sstevel@tonic-gate /* IFF_NOXMIT, IFF_NOLOCAL, */ 5607c478bd9Sstevel@tonic-gate /* IFF_LOOPBACK, IFF_DEPRECATED, or */ 5617c478bd9Sstevel@tonic-gate /* not IFF_UP). Has priority over */ 5627c478bd9Sstevel@tonic-gate /* LIFC_NOXMIT. */ 5637c478bd9Sstevel@tonic-gate #define LIFC_TEMPORARY 0x04 /* Include IFF_TEMPORARY interfaces */ 5647c478bd9Sstevel@tonic-gate #define LIFC_ALLZONES 0x08 /* Include all zones */ 5657c478bd9Sstevel@tonic-gate /* (must be issued from global zone) */ 566*e11c3f44Smeem #define LIFC_UNDER_IPMP 0x10 /* Include underlying IPMP interfaces */ 5677c478bd9Sstevel@tonic-gate 5687c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 5697c478bd9Sstevel@tonic-gate 5707c478bd9Sstevel@tonic-gate struct lifconf32 { 5717c478bd9Sstevel@tonic-gate sa_family_t lifc_family; 5727c478bd9Sstevel@tonic-gate int lifc_flags; /* request specific interfaces */ 5737c478bd9Sstevel@tonic-gate int32_t lifc_len; /* size of associated buffer */ 5747c478bd9Sstevel@tonic-gate union { 5757c478bd9Sstevel@tonic-gate caddr32_t lifcu_buf; 5767c478bd9Sstevel@tonic-gate caddr32_t lifcu_req; 5777c478bd9Sstevel@tonic-gate } lifc_lifcu; 5787c478bd9Sstevel@tonic-gate }; 5797c478bd9Sstevel@tonic-gate 5807c478bd9Sstevel@tonic-gate struct lifsrcof32 { 5817c478bd9Sstevel@tonic-gate uint_t lifs_ifindex; /* interface of interest */ 5827c478bd9Sstevel@tonic-gate size32_t lifs_maxlen; /* size of buffer: input */ 5837c478bd9Sstevel@tonic-gate size32_t lifs_len; /* size of buffer: output */ 5847c478bd9Sstevel@tonic-gate union { 5857c478bd9Sstevel@tonic-gate caddr32_t lifsu_buf; 5867c478bd9Sstevel@tonic-gate caddr32_t lifsu_req; 5877c478bd9Sstevel@tonic-gate } lifs_lifsu; 5887c478bd9Sstevel@tonic-gate }; 5897c478bd9Sstevel@tonic-gate 5907c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 5917c478bd9Sstevel@tonic-gate 592*e11c3f44Smeem /* 593*e11c3f44Smeem * IPMP group information, for use with SIOCGLIFGROUPINFO. 594*e11c3f44Smeem */ 595*e11c3f44Smeem typedef struct lifgroupinfo { 596*e11c3f44Smeem char gi_grname[LIFGRNAMSIZ]; /* group name (set by caller) */ 597*e11c3f44Smeem char gi_grifname[LIFNAMSIZ]; /* IPMP meta-interface name */ 598*e11c3f44Smeem char gi_m4ifname[LIFNAMSIZ]; /* v4 mcast interface name */ 599*e11c3f44Smeem char gi_m6ifname[LIFNAMSIZ]; /* v6 mcast interface name */ 600*e11c3f44Smeem char gi_bcifname[LIFNAMSIZ]; /* v4 bcast interface name */ 601*e11c3f44Smeem boolean_t gi_v4; /* group is plumbed for v4 */ 602*e11c3f44Smeem boolean_t gi_v6; /* group is plumbed for v6 */ 603*e11c3f44Smeem uint_t gi_nv4; /* # of underlying v4 if's */ 604*e11c3f44Smeem uint_t gi_nv6; /* # of underlying v6 if's */ 605*e11c3f44Smeem uint_t gi_mactype; /* DLPI mac type of group */ 606*e11c3f44Smeem } lifgroupinfo_t; 607*e11c3f44Smeem 6087c478bd9Sstevel@tonic-gate /* 6097c478bd9Sstevel@tonic-gate * OBSOLETE: Structure used in SIOCGIFCONF request. 6107c478bd9Sstevel@tonic-gate * Used to retrieve interface configuration 6117c478bd9Sstevel@tonic-gate * for machine (useful for programs which 6127c478bd9Sstevel@tonic-gate * must know all networks accessible). 6137c478bd9Sstevel@tonic-gate */ 6147c478bd9Sstevel@tonic-gate struct ifconf { 6157c478bd9Sstevel@tonic-gate int ifc_len; /* size of associated buffer */ 6167c478bd9Sstevel@tonic-gate union { 6177c478bd9Sstevel@tonic-gate caddr_t ifcu_buf; 6187c478bd9Sstevel@tonic-gate struct ifreq *ifcu_req; 6197c478bd9Sstevel@tonic-gate } ifc_ifcu; 6207c478bd9Sstevel@tonic-gate #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ 6217c478bd9Sstevel@tonic-gate #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ 6227c478bd9Sstevel@tonic-gate }; 6237c478bd9Sstevel@tonic-gate 6247c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 6257c478bd9Sstevel@tonic-gate 6267c478bd9Sstevel@tonic-gate struct ifconf32 { 6277c478bd9Sstevel@tonic-gate int32_t ifc_len; /* size of associated buffer */ 6287c478bd9Sstevel@tonic-gate union { 6297c478bd9Sstevel@tonic-gate caddr32_t ifcu_buf; 6307c478bd9Sstevel@tonic-gate caddr32_t ifcu_req; 6317c478bd9Sstevel@tonic-gate } ifc_ifcu; 6327c478bd9Sstevel@tonic-gate }; 6337c478bd9Sstevel@tonic-gate 6347c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 6357c478bd9Sstevel@tonic-gate 6367c478bd9Sstevel@tonic-gate typedef struct if_data { 6377c478bd9Sstevel@tonic-gate /* generic interface information */ 6387c478bd9Sstevel@tonic-gate uchar_t ifi_type; /* ethernet, tokenring, etc */ 6397c478bd9Sstevel@tonic-gate uchar_t ifi_addrlen; /* media address length */ 6407c478bd9Sstevel@tonic-gate uchar_t ifi_hdrlen; /* media header length */ 6417c478bd9Sstevel@tonic-gate uint_t ifi_mtu; /* maximum transmission unit */ 6427c478bd9Sstevel@tonic-gate uint_t ifi_metric; /* routing metric (external only) */ 6437c478bd9Sstevel@tonic-gate uint_t ifi_baudrate; /* linespeed */ 6447c478bd9Sstevel@tonic-gate /* volatile statistics */ 6457c478bd9Sstevel@tonic-gate uint_t ifi_ipackets; /* packets received on interface */ 6467c478bd9Sstevel@tonic-gate uint_t ifi_ierrors; /* input errors on interface */ 6477c478bd9Sstevel@tonic-gate uint_t ifi_opackets; /* packets sent on interface */ 6487c478bd9Sstevel@tonic-gate uint_t ifi_oerrors; /* output errors on interface */ 6497c478bd9Sstevel@tonic-gate uint_t ifi_collisions; /* collisions on csma interfaces */ 6507c478bd9Sstevel@tonic-gate uint_t ifi_ibytes; /* total number of octets received */ 6517c478bd9Sstevel@tonic-gate uint_t ifi_obytes; /* total number of octets sent */ 6527c478bd9Sstevel@tonic-gate uint_t ifi_imcasts; /* packets received via multicast */ 6537c478bd9Sstevel@tonic-gate uint_t ifi_omcasts; /* packets sent via multicast */ 6547c478bd9Sstevel@tonic-gate uint_t ifi_iqdrops; /* dropped on input, this interface */ 6557c478bd9Sstevel@tonic-gate uint_t ifi_noproto; /* destined for unsupported protocol */ 6567c478bd9Sstevel@tonic-gate #if defined(_LP64) 6577c478bd9Sstevel@tonic-gate struct timeval32 ifi_lastchange; /* last updated */ 6587c478bd9Sstevel@tonic-gate #else 6597c478bd9Sstevel@tonic-gate struct timeval ifi_lastchange; /* last updated */ 6607c478bd9Sstevel@tonic-gate #endif 6617c478bd9Sstevel@tonic-gate } if_data_t; 6627c478bd9Sstevel@tonic-gate 6637c478bd9Sstevel@tonic-gate /* 6647c478bd9Sstevel@tonic-gate * Message format for use in obtaining information about interfaces 6657c478bd9Sstevel@tonic-gate * from the routing socket 6667c478bd9Sstevel@tonic-gate */ 6677c478bd9Sstevel@tonic-gate typedef struct if_msghdr { 6687c478bd9Sstevel@tonic-gate ushort_t ifm_msglen; /* to skip over non-understood messages */ 6697c478bd9Sstevel@tonic-gate uchar_t ifm_version; /* future binary compatibility */ 6707c478bd9Sstevel@tonic-gate uchar_t ifm_type; /* message type */ 6717c478bd9Sstevel@tonic-gate int ifm_addrs; /* like rtm_addrs */ 6727c478bd9Sstevel@tonic-gate int ifm_flags; /* value of if_flags */ 6737c478bd9Sstevel@tonic-gate ushort_t ifm_index; /* index for associated ifp */ 6747c478bd9Sstevel@tonic-gate struct if_data ifm_data; /* statistics and other data about if */ 6757c478bd9Sstevel@tonic-gate } if_msghdr_t; 6767c478bd9Sstevel@tonic-gate 6777c478bd9Sstevel@tonic-gate /* 6787c478bd9Sstevel@tonic-gate * Message format for use in obtaining information about interface addresses 6797c478bd9Sstevel@tonic-gate * from the routing socket 6807c478bd9Sstevel@tonic-gate */ 6817c478bd9Sstevel@tonic-gate typedef struct ifa_msghdr { 6827c478bd9Sstevel@tonic-gate ushort_t ifam_msglen; /* to skip over non-understood messages */ 6837c478bd9Sstevel@tonic-gate uchar_t ifam_version; /* future binary compatibility */ 6847c478bd9Sstevel@tonic-gate uchar_t ifam_type; /* message type */ 6857c478bd9Sstevel@tonic-gate int ifam_addrs; /* like rtm_addrs */ 6867c478bd9Sstevel@tonic-gate int ifam_flags; /* route flags */ 6877c478bd9Sstevel@tonic-gate ushort_t ifam_index; /* index for associated ifp */ 6887c478bd9Sstevel@tonic-gate int ifam_metric; /* value of ipif_metric */ 6897c478bd9Sstevel@tonic-gate } ifa_msghdr_t; 6907c478bd9Sstevel@tonic-gate 6917c478bd9Sstevel@tonic-gate /* currently tunnels only support IPv4 or IPv6 */ 6927c478bd9Sstevel@tonic-gate enum ifta_proto { 6937c478bd9Sstevel@tonic-gate IFTAP_INVALID, 6947c478bd9Sstevel@tonic-gate IFTAP_IPV4, 6957c478bd9Sstevel@tonic-gate IFTAP_IPV6 6967c478bd9Sstevel@tonic-gate }; 6977c478bd9Sstevel@tonic-gate 6987c478bd9Sstevel@tonic-gate #define IFTUN_SECINFOLEN 8 /* In units of 32-bit words. */ 6997c478bd9Sstevel@tonic-gate #define IFTUN_VERSION 1 /* Current version number. */ 7007c478bd9Sstevel@tonic-gate 7017c478bd9Sstevel@tonic-gate /* 7027c478bd9Sstevel@tonic-gate * Used by tunneling module to get/set a tunnel parameters using 7037c478bd9Sstevel@tonic-gate * SIOCTUN[SG]PARAM. 7047c478bd9Sstevel@tonic-gate * 7057c478bd9Sstevel@tonic-gate * There is a version number and an array of uint32_t at the end of this 7067c478bd9Sstevel@tonic-gate * ioctl because in a perfect world, the ipsec_req_t would be inside 7077c478bd9Sstevel@tonic-gate * tun_addreq. Since this file is independent of IP (and IPsec), I have to 7087c478bd9Sstevel@tonic-gate * just leave room there, and have the appropriate handlers deal with the 7097c478bd9Sstevel@tonic-gate * security information. 7107c478bd9Sstevel@tonic-gate * 7117c478bd9Sstevel@tonic-gate * In the future, the sockaddr types and the ta_vers could be used together 7127c478bd9Sstevel@tonic-gate * to determine the nature of the security information that is at the end 7137c478bd9Sstevel@tonic-gate * of this ioctl. 7147c478bd9Sstevel@tonic-gate */ 7157c478bd9Sstevel@tonic-gate struct iftun_req { 7167c478bd9Sstevel@tonic-gate char ifta_lifr_name[LIFNAMSIZ]; /* if name */ 7177c478bd9Sstevel@tonic-gate struct sockaddr_storage ifta_saddr; /* source address */ 7187c478bd9Sstevel@tonic-gate struct sockaddr_storage ifta_daddr; /* destination address */ 7197c478bd9Sstevel@tonic-gate uint_t ifta_flags; /* See below */ 7207c478bd9Sstevel@tonic-gate /* IP version information is read only */ 7217c478bd9Sstevel@tonic-gate enum ifta_proto ifta_upper; /* IP version above tunnel */ 7227c478bd9Sstevel@tonic-gate enum ifta_proto ifta_lower; /* IP version below tunnel */ 7237c478bd9Sstevel@tonic-gate uint_t ifta_vers; /* Version number */ 7247c478bd9Sstevel@tonic-gate uint32_t ifta_secinfo[IFTUN_SECINFOLEN]; /* Security prefs. */ 7257c478bd9Sstevel@tonic-gate int16_t ifta_encap_lim; /* Encapsulation limit */ 7267c478bd9Sstevel@tonic-gate uint8_t ifta_hop_limit; /* Hop limit */ 7277c478bd9Sstevel@tonic-gate uint8_t ifta_spare0; /* Pad to 64-bit boundary */ 7287c478bd9Sstevel@tonic-gate uint32_t ifta_spare1; 7297c478bd9Sstevel@tonic-gate }; 7307c478bd9Sstevel@tonic-gate 7317c478bd9Sstevel@tonic-gate /* ifta_flags are set to indicate which members are valid */ 7327c478bd9Sstevel@tonic-gate #define IFTUN_SRC 0x01 7337c478bd9Sstevel@tonic-gate #define IFTUN_DST 0x02 7347c478bd9Sstevel@tonic-gate #define IFTUN_SECURITY 0x04 /* Pay attention to secinfo */ 7357c478bd9Sstevel@tonic-gate #define IFTUN_ENCAP 0x08 /* Pay attention to encap */ 7367c478bd9Sstevel@tonic-gate #define IFTUN_HOPLIMIT 0x10 /* Pay attention to hoplimit */ 7378810c16bSdanmcd #define IFTUN_COMPLEX_SECURITY 0x20 /* Policy too big for ioctl */ 7387c478bd9Sstevel@tonic-gate 7397c478bd9Sstevel@tonic-gate #endif /* !defined(_XOPEN_SOURCE) || defined(__EXTENSIONS__) */ 7407c478bd9Sstevel@tonic-gate 7417c478bd9Sstevel@tonic-gate /* 7427c478bd9Sstevel@tonic-gate * The if_nameindex structure holds the interface index value about 7437c478bd9Sstevel@tonic-gate * a single interface. An array of this structure is used to return 7447c478bd9Sstevel@tonic-gate * all interfaces and indexes. 7457c478bd9Sstevel@tonic-gate */ 7467c478bd9Sstevel@tonic-gate struct if_nameindex { 7477c478bd9Sstevel@tonic-gate unsigned if_index; /* positive interface index */ 7487c478bd9Sstevel@tonic-gate char *if_name; /* if name, e.g. "en0" */ 7497c478bd9Sstevel@tonic-gate }; 7507c478bd9Sstevel@tonic-gate 7517c478bd9Sstevel@tonic-gate /* Interface index identification API definitions */ 7527c478bd9Sstevel@tonic-gate extern unsigned if_nametoindex(const char *); 7537c478bd9Sstevel@tonic-gate extern char *if_indextoname(unsigned, char *); 7547c478bd9Sstevel@tonic-gate extern struct if_nameindex *if_nameindex(void); 7557c478bd9Sstevel@tonic-gate extern void if_freenameindex(struct if_nameindex *); 7567c478bd9Sstevel@tonic-gate 7577c478bd9Sstevel@tonic-gate #define IF_NAMESIZE _LIFNAMSIZ 7587c478bd9Sstevel@tonic-gate 7597c478bd9Sstevel@tonic-gate #ifdef __cplusplus 7607c478bd9Sstevel@tonic-gate } 7617c478bd9Sstevel@tonic-gate #endif 7627c478bd9Sstevel@tonic-gate 7637c478bd9Sstevel@tonic-gate #endif /* _NET_IF_H */ 764