blob: 97bf4930ca43d8cf768da7f040f22d905596180f [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 _UAPI_LINUX_IN_H
8#define _UAPI_LINUX_IN_H
Elliott Hughes64f355f2017-08-30 16:10:24 -07009#include <bits/ip_msfilter.h>
10#include <bits/ip_mreq_source.h>
11#include <bits/in_addr.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070012#include <linux/types.h>
Christopher Ferris6cd53a52022-12-12 23:39:16 +000013#include <linux/stddef.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080014#include <linux/libc-compat.h>
Christopher Ferris05d08e92016-02-04 13:16:38 -080015#include <linux/socket.h>
16#if __UAPI_DEF_IN_IPPROTO
Ben Cheng655a7c02013-10-16 16:09:24 -070017enum {
Tao Baod7db5942015-01-28 10:07:51 -080018 IPPROTO_IP = 0,
Christopher Ferris38062f92014-07-09 15:33:25 -070019#define IPPROTO_IP IPPROTO_IP
Tao Baod7db5942015-01-28 10:07:51 -080020 IPPROTO_ICMP = 1,
Christopher Ferris38062f92014-07-09 15:33:25 -070021#define IPPROTO_ICMP IPPROTO_ICMP
Tao Baod7db5942015-01-28 10:07:51 -080022 IPPROTO_IGMP = 2,
Christopher Ferris38062f92014-07-09 15:33:25 -070023#define IPPROTO_IGMP IPPROTO_IGMP
Tao Baod7db5942015-01-28 10:07:51 -080024 IPPROTO_IPIP = 4,
Christopher Ferris38062f92014-07-09 15:33:25 -070025#define IPPROTO_IPIP IPPROTO_IPIP
Tao Baod7db5942015-01-28 10:07:51 -080026 IPPROTO_TCP = 6,
Christopher Ferris38062f92014-07-09 15:33:25 -070027#define IPPROTO_TCP IPPROTO_TCP
Tao Baod7db5942015-01-28 10:07:51 -080028 IPPROTO_EGP = 8,
Christopher Ferris38062f92014-07-09 15:33:25 -070029#define IPPROTO_EGP IPPROTO_EGP
Tao Baod7db5942015-01-28 10:07:51 -080030 IPPROTO_PUP = 12,
Christopher Ferris38062f92014-07-09 15:33:25 -070031#define IPPROTO_PUP IPPROTO_PUP
Tao Baod7db5942015-01-28 10:07:51 -080032 IPPROTO_UDP = 17,
Christopher Ferris38062f92014-07-09 15:33:25 -070033#define IPPROTO_UDP IPPROTO_UDP
Tao Baod7db5942015-01-28 10:07:51 -080034 IPPROTO_IDP = 22,
Christopher Ferris38062f92014-07-09 15:33:25 -070035#define IPPROTO_IDP IPPROTO_IDP
Tao Baod7db5942015-01-28 10:07:51 -080036 IPPROTO_TP = 29,
Christopher Ferris38062f92014-07-09 15:33:25 -070037#define IPPROTO_TP IPPROTO_TP
Tao Baod7db5942015-01-28 10:07:51 -080038 IPPROTO_DCCP = 33,
Christopher Ferris38062f92014-07-09 15:33:25 -070039#define IPPROTO_DCCP IPPROTO_DCCP
Tao Baod7db5942015-01-28 10:07:51 -080040 IPPROTO_IPV6 = 41,
Christopher Ferris38062f92014-07-09 15:33:25 -070041#define IPPROTO_IPV6 IPPROTO_IPV6
Tao Baod7db5942015-01-28 10:07:51 -080042 IPPROTO_RSVP = 46,
Christopher Ferris38062f92014-07-09 15:33:25 -070043#define IPPROTO_RSVP IPPROTO_RSVP
Tao Baod7db5942015-01-28 10:07:51 -080044 IPPROTO_GRE = 47,
Christopher Ferris38062f92014-07-09 15:33:25 -070045#define IPPROTO_GRE IPPROTO_GRE
Tao Baod7db5942015-01-28 10:07:51 -080046 IPPROTO_ESP = 50,
Christopher Ferris38062f92014-07-09 15:33:25 -070047#define IPPROTO_ESP IPPROTO_ESP
Tao Baod7db5942015-01-28 10:07:51 -080048 IPPROTO_AH = 51,
Christopher Ferris38062f92014-07-09 15:33:25 -070049#define IPPROTO_AH IPPROTO_AH
Tao Baod7db5942015-01-28 10:07:51 -080050 IPPROTO_MTP = 92,
Christopher Ferris38062f92014-07-09 15:33:25 -070051#define IPPROTO_MTP IPPROTO_MTP
Tao Baod7db5942015-01-28 10:07:51 -080052 IPPROTO_BEETPH = 94,
Christopher Ferris38062f92014-07-09 15:33:25 -070053#define IPPROTO_BEETPH IPPROTO_BEETPH
Tao Baod7db5942015-01-28 10:07:51 -080054 IPPROTO_ENCAP = 98,
Christopher Ferris38062f92014-07-09 15:33:25 -070055#define IPPROTO_ENCAP IPPROTO_ENCAP
Tao Baod7db5942015-01-28 10:07:51 -080056 IPPROTO_PIM = 103,
Christopher Ferris38062f92014-07-09 15:33:25 -070057#define IPPROTO_PIM IPPROTO_PIM
Tao Baod7db5942015-01-28 10:07:51 -080058 IPPROTO_COMP = 108,
Christopher Ferris38062f92014-07-09 15:33:25 -070059#define IPPROTO_COMP IPPROTO_COMP
Christopher Ferris6cd53a52022-12-12 23:39:16 +000060 IPPROTO_L2TP = 115,
61#define IPPROTO_L2TP IPPROTO_L2TP
Tao Baod7db5942015-01-28 10:07:51 -080062 IPPROTO_SCTP = 132,
Christopher Ferris38062f92014-07-09 15:33:25 -070063#define IPPROTO_SCTP IPPROTO_SCTP
Tao Baod7db5942015-01-28 10:07:51 -080064 IPPROTO_UDPLITE = 136,
Christopher Ferris38062f92014-07-09 15:33:25 -070065#define IPPROTO_UDPLITE IPPROTO_UDPLITE
Christopher Ferris05d08e92016-02-04 13:16:38 -080066 IPPROTO_MPLS = 137,
67#define IPPROTO_MPLS IPPROTO_MPLS
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070068 IPPROTO_ETHERNET = 143,
69#define IPPROTO_ETHERNET IPPROTO_ETHERNET
Tao Baod7db5942015-01-28 10:07:51 -080070 IPPROTO_RAW = 255,
Christopher Ferris38062f92014-07-09 15:33:25 -070071#define IPPROTO_RAW IPPROTO_RAW
Christopher Ferris4ba54492024-09-18 16:25:22 +000072 IPPROTO_SMC = 256,
73#define IPPROTO_SMC IPPROTO_SMC
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070074 IPPROTO_MPTCP = 262,
75#define IPPROTO_MPTCP IPPROTO_MPTCP
Tao Baod7db5942015-01-28 10:07:51 -080076 IPPROTO_MAX
Ben Cheng655a7c02013-10-16 16:09:24 -070077};
Christopher Ferris05d08e92016-02-04 13:16:38 -080078#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -080079#if __UAPI_DEF_IN_ADDR
Christopher Ferris05d08e92016-02-04 13:16:38 -080080#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070081#define IP_TOS 1
Ben Cheng655a7c02013-10-16 16:09:24 -070082#define IP_TTL 2
83#define IP_HDRINCL 3
84#define IP_OPTIONS 4
85#define IP_ROUTER_ALERT 5
Ben Cheng655a7c02013-10-16 16:09:24 -070086#define IP_RECVOPTS 6
87#define IP_RETOPTS 7
88#define IP_PKTINFO 8
89#define IP_PKTOPTIONS 9
Ben Cheng655a7c02013-10-16 16:09:24 -070090#define IP_MTU_DISCOVER 10
91#define IP_RECVERR 11
92#define IP_RECVTTL 12
93#define IP_RECVTOS 13
Ben Cheng655a7c02013-10-16 16:09:24 -070094#define IP_MTU 14
95#define IP_FREEBIND 15
96#define IP_IPSEC_POLICY 16
97#define IP_XFRM_POLICY 17
Ben Cheng655a7c02013-10-16 16:09:24 -070098#define IP_PASSSEC 18
99#define IP_TRANSPARENT 19
100#define IP_RECVRETOPTS IP_RETOPTS
101#define IP_ORIGDSTADDR 20
Ben Cheng655a7c02013-10-16 16:09:24 -0700102#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
103#define IP_MINTTL 21
Christopher Ferris05d08e92016-02-04 13:16:38 -0800104#define IP_NODEFRAG 22
105#define IP_CHECKSUM 23
106#define IP_BIND_ADDRESS_NO_PORT 24
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800107#define IP_RECVFRAGSIZE 25
Christopher Ferris25c18d42020-10-14 17:42:58 -0700108#define IP_RECVERR_RFC4884 26
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800109#define IP_PMTUDISC_DONT 0
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110#define IP_PMTUDISC_WANT 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700111#define IP_PMTUDISC_DO 2
112#define IP_PMTUDISC_PROBE 3
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800113#define IP_PMTUDISC_INTERFACE 4
Christopher Ferris05d08e92016-02-04 13:16:38 -0800114#define IP_PMTUDISC_OMIT 5
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700115#define IP_MULTICAST_IF 32
Ben Cheng655a7c02013-10-16 16:09:24 -0700116#define IP_MULTICAST_TTL 33
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800117#define IP_MULTICAST_LOOP 34
Christopher Ferris05d08e92016-02-04 13:16:38 -0800118#define IP_ADD_MEMBERSHIP 35
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700119#define IP_DROP_MEMBERSHIP 36
Ben Cheng655a7c02013-10-16 16:09:24 -0700120#define IP_UNBLOCK_SOURCE 37
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800121#define IP_BLOCK_SOURCE 38
Christopher Ferris05d08e92016-02-04 13:16:38 -0800122#define IP_ADD_SOURCE_MEMBERSHIP 39
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700123#define IP_DROP_SOURCE_MEMBERSHIP 40
Ben Cheng655a7c02013-10-16 16:09:24 -0700124#define IP_MSFILTER 41
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800125#define MCAST_JOIN_GROUP 42
Christopher Ferris05d08e92016-02-04 13:16:38 -0800126#define MCAST_BLOCK_SOURCE 43
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700127#define MCAST_UNBLOCK_SOURCE 44
Ben Cheng655a7c02013-10-16 16:09:24 -0700128#define MCAST_LEAVE_GROUP 45
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800129#define MCAST_JOIN_SOURCE_GROUP 46
Christopher Ferris05d08e92016-02-04 13:16:38 -0800130#define MCAST_LEAVE_SOURCE_GROUP 47
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700131#define MCAST_MSFILTER 48
Ben Cheng655a7c02013-10-16 16:09:24 -0700132#define IP_MULTICAST_ALL 49
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800133#define IP_UNICAST_IF 50
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000134#define IP_LOCAL_PORT_RANGE 51
Christopher Ferris37c3f3c2023-07-10 10:59:05 -0700135#define IP_PROTOCOL 52
Christopher Ferris05d08e92016-02-04 13:16:38 -0800136#define MCAST_EXCLUDE 0
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700137#define MCAST_INCLUDE 1
Ben Cheng655a7c02013-10-16 16:09:24 -0700138#define IP_DEFAULT_MULTICAST_TTL 1
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800139#define IP_DEFAULT_MULTICAST_LOOP 1
Christopher Ferris05d08e92016-02-04 13:16:38 -0800140#if __UAPI_DEF_IP_MREQ
141struct ip_mreq {
Tao Baod7db5942015-01-28 10:07:51 -0800142 struct in_addr imr_multiaddr;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800143 struct in_addr imr_interface;
Ben Cheng655a7c02013-10-16 16:09:24 -0700144};
145struct ip_mreqn {
Tao Baod7db5942015-01-28 10:07:51 -0800146 struct in_addr imr_multiaddr;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800147 struct in_addr imr_address;
Tao Baod7db5942015-01-28 10:07:51 -0800148 int imr_ifindex;
Ben Cheng655a7c02013-10-16 16:09:24 -0700149};
Tao Baod7db5942015-01-28 10:07:51 -0800150#define IP_MSFILTER_SIZE(numsrc) (sizeof(struct ip_msfilter) - sizeof(__u32) + (numsrc) * sizeof(__u32))
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800151struct group_req {
Tao Baod7db5942015-01-28 10:07:51 -0800152 __u32 gr_interface;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800153 struct sockaddr_storage gr_group;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700154};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800155struct group_source_req {
Tao Baod7db5942015-01-28 10:07:51 -0800156 __u32 gsr_interface;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800157 struct sockaddr_storage gsr_group;
158 struct sockaddr_storage gsr_source;
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800159};
Ben Cheng655a7c02013-10-16 16:09:24 -0700160struct group_filter {
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700161 union {
162 struct {
163 __u32 gf_interface_aux;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800164 struct sockaddr_storage gf_group_aux;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700165 __u32 gf_fmode_aux;
166 __u32 gf_numsrc_aux;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800167 struct sockaddr_storage gf_slist[1];
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700168 };
169 struct {
170 __u32 gf_interface;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800171 struct sockaddr_storage gf_group;
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700172 __u32 gf_fmode;
173 __u32 gf_numsrc;
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800174 struct sockaddr_storage gf_slist_flex[];
Christopher Ferris2abfa9e2021-11-01 16:26:06 -0700175 };
176 };
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700177};
Elliott Hughes5850f6f2023-11-29 11:18:49 -0800178#define GROUP_FILTER_SIZE(numsrc) (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) + (numsrc) * sizeof(struct sockaddr_storage))
Christopher Ferris05d08e92016-02-04 13:16:38 -0800179#endif
180#if __UAPI_DEF_IN_PKTINFO
Ben Cheng655a7c02013-10-16 16:09:24 -0700181struct in_pktinfo {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800182 int ipi_ifindex;
Tao Baod7db5942015-01-28 10:07:51 -0800183 struct in_addr ipi_spec_dst;
184 struct in_addr ipi_addr;
Ben Cheng655a7c02013-10-16 16:09:24 -0700185};
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800186#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -0800187#if __UAPI_DEF_SOCKADDR_IN
188#define __SOCK_SIZE__ 16
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700189struct sockaddr_in {
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800190 __kernel_sa_family_t sin_family;
Tao Baod7db5942015-01-28 10:07:51 -0800191 __be16 sin_port;
192 struct in_addr sin_addr;
Tao Baod7db5942015-01-28 10:07:51 -0800193 unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)];
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800194};
Ben Cheng655a7c02013-10-16 16:09:24 -0700195#define sin_zero __pad
Christopher Ferris05d08e92016-02-04 13:16:38 -0800196#endif
197#if __UAPI_DEF_IN_CLASS
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800198#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
Ben Cheng655a7c02013-10-16 16:09:24 -0700199#define IN_CLASSA_NET 0xff000000
200#define IN_CLASSA_NSHIFT 24
201#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800202#define IN_CLASSA_MAX 128
Ben Cheng655a7c02013-10-16 16:09:24 -0700203#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
204#define IN_CLASSB_NET 0xffff0000
205#define IN_CLASSB_NSHIFT 16
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800206#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
Ben Cheng655a7c02013-10-16 16:09:24 -0700207#define IN_CLASSB_MAX 65536
208#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
209#define IN_CLASSC_NET 0xffffff00
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800210#define IN_CLASSC_NSHIFT 8
Ben Cheng655a7c02013-10-16 16:09:24 -0700211#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
212#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
213#define IN_MULTICAST(a) IN_CLASSD(a)
Christopher Ferris86a48372019-01-10 14:14:59 -0800214#define IN_MULTICAST_NET 0xe0000000
Christopher Ferrisd842e432019-03-07 10:21:59 -0800215#define IN_BADCLASS(a) (((long int) (a)) == (long int) 0xffffffff)
Christopher Ferris86a48372019-01-10 14:14:59 -0800216#define IN_EXPERIMENTAL(a) IN_BADCLASS((a))
217#define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
218#define IN_CLASSE_NET 0xffffffff
219#define IN_CLASSE_NSHIFT 0
Ben Cheng655a7c02013-10-16 16:09:24 -0700220#define INADDR_ANY ((unsigned long int) 0x00000000)
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800221#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
Ben Cheng655a7c02013-10-16 16:09:24 -0700222#define INADDR_NONE ((unsigned long int) 0xffffffff)
Christopher Ferrisfcc3b4f2021-07-01 01:30:21 +0000223#define INADDR_DUMMY ((unsigned long int) 0xc0000008)
Ben Cheng655a7c02013-10-16 16:09:24 -0700224#define IN_LOOPBACKNET 127
225#define INADDR_LOOPBACK 0x7f000001
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800226#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
Ben Cheng655a7c02013-10-16 16:09:24 -0700227#define INADDR_UNSPEC_GROUP 0xe0000000U
228#define INADDR_ALLHOSTS_GROUP 0xe0000001U
229#define INADDR_ALLRTRS_GROUP 0xe0000002U
Christopher Ferris24f97eb2019-05-20 12:58:13 -0700230#define INADDR_ALLSNOOPERS_GROUP 0xe000006aU
Christopher Ferris48af7cb2017-02-21 12:35:09 -0800231#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU
Christopher Ferris05d08e92016-02-04 13:16:38 -0800232#endif
Ben Cheng655a7c02013-10-16 16:09:24 -0700233#include <asm/byteorder.h>
234#endif