blob: 8e551eb28fb27925b04b6bcd69cc6a62a4ac6baa [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _LINUX_IF_H
8#define _LINUX_IF_H
Christopher Ferris82ef6a12016-05-19 16:36:40 -07009#include <linux/libc-compat.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070010#include <linux/types.h>
Christopher Ferris82ef6a12016-05-19 16:36:40 -070011#include <linux/socket.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070012#include <linux/compiler.h>
Christopher Ferris525ce912017-07-26 13:12:53 -070013#include <sys/socket.h>
Christopher Ferris82ef6a12016-05-19 16:36:40 -070014#if __UAPI_DEF_IF_IFNAMSIZ
Ben Cheng655a7c02013-10-16 16:09:24 -070015#define IFNAMSIZ 16
Christopher Ferris82ef6a12016-05-19 16:36:40 -070016#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070017#define IFALIASZ 256
Christopher Ferrisd32ca142020-02-04 16:16:51 -080018#define ALTIFNAMSIZ 128
Ben Cheng655a7c02013-10-16 16:09:24 -070019#include <linux/hdlc/ioctl.h>
Christopher Ferris6a9755d2017-01-13 14:09:31 -080020#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070021enum net_device_flags {
Christopher Ferris82ef6a12016-05-19 16:36:40 -070022#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
Elliott Hughes64f355f2017-08-30 16:10:24 -070023 IFF_UP = 1 << 0,
24 IFF_BROADCAST = 1 << 1,
25 IFF_DEBUG = 1 << 2,
26 IFF_LOOPBACK = 1 << 3,
27 IFF_POINTOPOINT = 1 << 4,
28 IFF_NOTRAILERS = 1 << 5,
29 IFF_RUNNING = 1 << 6,
30 IFF_NOARP = 1 << 7,
31 IFF_PROMISC = 1 << 8,
32 IFF_ALLMULTI = 1 << 9,
33 IFF_MASTER = 1 << 10,
34 IFF_SLAVE = 1 << 11,
35 IFF_MULTICAST = 1 << 12,
36 IFF_PORTSEL = 1 << 13,
37 IFF_AUTOMEDIA = 1 << 14,
38 IFF_DYNAMIC = 1 << 15,
Christopher Ferris82ef6a12016-05-19 16:36:40 -070039#endif
Christopher Ferris82ef6a12016-05-19 16:36:40 -070040#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
Elliott Hughes64f355f2017-08-30 16:10:24 -070041 IFF_LOWER_UP = 1 << 16,
42 IFF_DORMANT = 1 << 17,
43 IFF_ECHO = 1 << 18,
Christopher Ferris82ef6a12016-05-19 16:36:40 -070044#endif
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070045};
Christopher Ferris82ef6a12016-05-19 16:36:40 -070046#endif
47#if __UAPI_DEF_IF_NET_DEVICE_FLAGS
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070048#define IFF_UP IFF_UP
49#define IFF_BROADCAST IFF_BROADCAST
Christopher Ferris82ef6a12016-05-19 16:36:40 -070050#define IFF_DEBUG IFF_DEBUG
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070051#define IFF_LOOPBACK IFF_LOOPBACK
52#define IFF_POINTOPOINT IFF_POINTOPOINT
53#define IFF_NOTRAILERS IFF_NOTRAILERS
Christopher Ferris82ef6a12016-05-19 16:36:40 -070054#define IFF_RUNNING IFF_RUNNING
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070055#define IFF_NOARP IFF_NOARP
56#define IFF_PROMISC IFF_PROMISC
57#define IFF_ALLMULTI IFF_ALLMULTI
Christopher Ferris82ef6a12016-05-19 16:36:40 -070058#define IFF_MASTER IFF_MASTER
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070059#define IFF_SLAVE IFF_SLAVE
60#define IFF_MULTICAST IFF_MULTICAST
61#define IFF_PORTSEL IFF_PORTSEL
Christopher Ferris82ef6a12016-05-19 16:36:40 -070062#define IFF_AUTOMEDIA IFF_AUTOMEDIA
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070063#define IFF_DYNAMIC IFF_DYNAMIC
Christopher Ferris82ef6a12016-05-19 16:36:40 -070064#endif
65#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070066#define IFF_LOWER_UP IFF_LOWER_UP
67#define IFF_DORMANT IFF_DORMANT
68#define IFF_ECHO IFF_ECHO
Christopher Ferris82ef6a12016-05-19 16:36:40 -070069#endif
Tao Baod7db5942015-01-28 10:07:51 -080070#define IFF_VOLATILE (IFF_LOOPBACK | IFF_POINTOPOINT | IFF_BROADCAST | IFF_ECHO | IFF_MASTER | IFF_SLAVE | IFF_RUNNING | IFF_LOWER_UP | IFF_DORMANT)
Ben Cheng655a7c02013-10-16 16:09:24 -070071#define IF_GET_IFACE 0x0001
72#define IF_GET_PROTO 0x0002
Christopher Ferris38062f92014-07-09 15:33:25 -070073#define IF_IFACE_V35 0x1000
Ben Cheng655a7c02013-10-16 16:09:24 -070074#define IF_IFACE_V24 0x1001
75#define IF_IFACE_X21 0x1002
76#define IF_IFACE_T1 0x1003
Christopher Ferris38062f92014-07-09 15:33:25 -070077#define IF_IFACE_E1 0x1004
Ben Cheng655a7c02013-10-16 16:09:24 -070078#define IF_IFACE_SYNC_SERIAL 0x1005
79#define IF_IFACE_X21D 0x1006
80#define IF_PROTO_HDLC 0x2000
Christopher Ferris38062f92014-07-09 15:33:25 -070081#define IF_PROTO_PPP 0x2001
Ben Cheng655a7c02013-10-16 16:09:24 -070082#define IF_PROTO_CISCO 0x2002
83#define IF_PROTO_FR 0x2003
84#define IF_PROTO_FR_ADD_PVC 0x2004
Christopher Ferris38062f92014-07-09 15:33:25 -070085#define IF_PROTO_FR_DEL_PVC 0x2005
Ben Cheng655a7c02013-10-16 16:09:24 -070086#define IF_PROTO_X25 0x2006
87#define IF_PROTO_HDLC_ETH 0x2007
88#define IF_PROTO_FR_ADD_ETH_PVC 0x2008
Christopher Ferris38062f92014-07-09 15:33:25 -070089#define IF_PROTO_FR_DEL_ETH_PVC 0x2009
Ben Cheng655a7c02013-10-16 16:09:24 -070090#define IF_PROTO_FR_PVC 0x200A
91#define IF_PROTO_FR_ETH_PVC 0x200B
92#define IF_PROTO_RAW 0x200C
Christopher Ferris38062f92014-07-09 15:33:25 -070093enum {
Tao Baod7db5942015-01-28 10:07:51 -080094 IF_OPER_UNKNOWN,
95 IF_OPER_NOTPRESENT,
96 IF_OPER_DOWN,
97 IF_OPER_LOWERLAYERDOWN,
Tao Baod7db5942015-01-28 10:07:51 -080098 IF_OPER_TESTING,
99 IF_OPER_DORMANT,
100 IF_OPER_UP,
Christopher Ferris38062f92014-07-09 15:33:25 -0700101};
Ben Cheng655a7c02013-10-16 16:09:24 -0700102enum {
Tao Baod7db5942015-01-28 10:07:51 -0800103 IF_LINK_MODE_DEFAULT,
104 IF_LINK_MODE_DORMANT,
Christopher Ferris8177cdf2020-08-03 11:53:55 -0700105 IF_LINK_MODE_TESTING,
Christopher Ferris38062f92014-07-09 15:33:25 -0700106};
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700107#if __UAPI_DEF_IF_IFMAP
Ben Cheng655a7c02013-10-16 16:09:24 -0700108struct ifmap {
Tao Baod7db5942015-01-28 10:07:51 -0800109 unsigned long mem_start;
110 unsigned long mem_end;
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700111 unsigned short base_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800112 unsigned char irq;
113 unsigned char dma;
114 unsigned char port;
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700115};
116#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700117struct if_settings {
Tao Baod7db5942015-01-28 10:07:51 -0800118 unsigned int type;
119 unsigned int size;
120 union {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700121 raw_hdlc_proto * raw_hdlc;
122 cisco_proto * cisco;
123 fr_proto * fr;
124 fr_proto_pvc * fr_pvc;
125 fr_proto_pvc_info * fr_pvc_info;
126 x25_hdlc_proto * x25;
127 sync_serial_settings * sync;
128 te1_settings * te1;
Tao Baod7db5942015-01-28 10:07:51 -0800129 } ifs_ifsu;
Ben Cheng655a7c02013-10-16 16:09:24 -0700130};
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700131#if __UAPI_DEF_IF_IFREQ
Ben Cheng655a7c02013-10-16 16:09:24 -0700132struct ifreq {
133#define IFHWADDRLEN 6
Tao Baod7db5942015-01-28 10:07:51 -0800134 union {
Tao Baod7db5942015-01-28 10:07:51 -0800135 char ifrn_name[IFNAMSIZ];
136 } ifr_ifrn;
137 union {
138 struct sockaddr ifru_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800139 struct sockaddr ifru_dstaddr;
140 struct sockaddr ifru_broadaddr;
141 struct sockaddr ifru_netmask;
142 struct sockaddr ifru_hwaddr;
Tao Baod7db5942015-01-28 10:07:51 -0800143 short ifru_flags;
144 int ifru_ivalue;
145 int ifru_mtu;
146 struct ifmap ifru_map;
Tao Baod7db5942015-01-28 10:07:51 -0800147 char ifru_slave[IFNAMSIZ];
148 char ifru_newname[IFNAMSIZ];
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700149 void * ifru_data;
Tao Baod7db5942015-01-28 10:07:51 -0800150 struct if_settings ifru_settings;
Tao Baod7db5942015-01-28 10:07:51 -0800151 } ifr_ifru;
Ben Cheng655a7c02013-10-16 16:09:24 -0700152};
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700153#endif
Christopher Ferris38062f92014-07-09 15:33:25 -0700154#define ifr_name ifr_ifrn.ifrn_name
Ben Cheng655a7c02013-10-16 16:09:24 -0700155#define ifr_hwaddr ifr_ifru.ifru_hwaddr
156#define ifr_addr ifr_ifru.ifru_addr
157#define ifr_dstaddr ifr_ifru.ifru_dstaddr
Christopher Ferris38062f92014-07-09 15:33:25 -0700158#define ifr_broadaddr ifr_ifru.ifru_broadaddr
Ben Cheng655a7c02013-10-16 16:09:24 -0700159#define ifr_netmask ifr_ifru.ifru_netmask
160#define ifr_flags ifr_ifru.ifru_flags
161#define ifr_metric ifr_ifru.ifru_ivalue
Christopher Ferris38062f92014-07-09 15:33:25 -0700162#define ifr_mtu ifr_ifru.ifru_mtu
Ben Cheng655a7c02013-10-16 16:09:24 -0700163#define ifr_map ifr_ifru.ifru_map
164#define ifr_slave ifr_ifru.ifru_slave
165#define ifr_data ifr_ifru.ifru_data
Christopher Ferris38062f92014-07-09 15:33:25 -0700166#define ifr_ifindex ifr_ifru.ifru_ivalue
Ben Cheng655a7c02013-10-16 16:09:24 -0700167#define ifr_bandwidth ifr_ifru.ifru_ivalue
168#define ifr_qlen ifr_ifru.ifru_ivalue
169#define ifr_newname ifr_ifru.ifru_newname
Christopher Ferris38062f92014-07-09 15:33:25 -0700170#define ifr_settings ifr_ifru.ifru_settings
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700171#if __UAPI_DEF_IF_IFCONF
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700172struct ifconf {
Tao Baod7db5942015-01-28 10:07:51 -0800173 int ifc_len;
174 union {
Elliott Hughes0f0c18f2023-03-29 15:53:31 -0700175 char * ifcu_buf;
176 struct ifreq * ifcu_req;
Tao Baod7db5942015-01-28 10:07:51 -0800177 } ifc_ifcu;
Ben Cheng655a7c02013-10-16 16:09:24 -0700178};
Christopher Ferris82ef6a12016-05-19 16:36:40 -0700179#endif
Christopher Ferris38062f92014-07-09 15:33:25 -0700180#define ifc_buf ifc_ifcu.ifcu_buf
Ben Cheng655a7c02013-10-16 16:09:24 -0700181#define ifc_req ifc_ifcu.ifcu_req
Ben Cheng655a7c02013-10-16 16:09:24 -0700182#endif