| 1 | /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ | 
|---|
| 2 | /* | 
|---|
| 3 | * INET		An implementation of the TCP/IP protocol suite for the LINUX | 
|---|
| 4 | *		operating system.  INET is implemented using the  BSD Socket | 
|---|
| 5 | *		interface as the means of communication with the user level. | 
|---|
| 6 | * | 
|---|
| 7 | *		Definitions for the IP protocol. | 
|---|
| 8 | * | 
|---|
| 9 | * Version:	@(#)ip.h	1.0.2	04/28/93 | 
|---|
| 10 | * | 
|---|
| 11 | * Authors:	Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 
|---|
| 12 | * | 
|---|
| 13 | *		This program is free software; you can redistribute it and/or | 
|---|
| 14 | *		modify it under the terms of the GNU General Public License | 
|---|
| 15 | *		as published by the Free Software Foundation; either version | 
|---|
| 16 | *		2 of the License, or (at your option) any later version. | 
|---|
| 17 | */ | 
|---|
| 18 | #ifndef _UAPI_LINUX_IP_H | 
|---|
| 19 | #define _UAPI_LINUX_IP_H | 
|---|
| 20 | #include <linux/types.h> | 
|---|
| 21 | #include <linux/stddef.h> | 
|---|
| 22 | #include <asm/byteorder.h> | 
|---|
| 23 |  | 
|---|
| 24 | #define IPTOS_TOS_MASK		0x1E | 
|---|
| 25 | #define IPTOS_TOS(tos)		((tos)&IPTOS_TOS_MASK) | 
|---|
| 26 | #define	IPTOS_LOWDELAY		0x10 | 
|---|
| 27 | #define	IPTOS_THROUGHPUT	0x08 | 
|---|
| 28 | #define	IPTOS_RELIABILITY	0x04 | 
|---|
| 29 | #define	IPTOS_MINCOST		0x02 | 
|---|
| 30 |  | 
|---|
| 31 | #define IPTOS_PREC_MASK		0xE0 | 
|---|
| 32 | #define IPTOS_PREC(tos)		((tos)&IPTOS_PREC_MASK) | 
|---|
| 33 | #define IPTOS_PREC_NETCONTROL           0xe0 | 
|---|
| 34 | #define IPTOS_PREC_INTERNETCONTROL      0xc0 | 
|---|
| 35 | #define IPTOS_PREC_CRITIC_ECP           0xa0 | 
|---|
| 36 | #define IPTOS_PREC_FLASHOVERRIDE        0x80 | 
|---|
| 37 | #define IPTOS_PREC_FLASH                0x60 | 
|---|
| 38 | #define IPTOS_PREC_IMMEDIATE            0x40 | 
|---|
| 39 | #define IPTOS_PREC_PRIORITY             0x20 | 
|---|
| 40 | #define IPTOS_PREC_ROUTINE              0x00 | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | /* IP options */ | 
|---|
| 44 | #define IPOPT_COPY		0x80 | 
|---|
| 45 | #define IPOPT_CLASS_MASK	0x60 | 
|---|
| 46 | #define IPOPT_NUMBER_MASK	0x1f | 
|---|
| 47 |  | 
|---|
| 48 | #define	IPOPT_COPIED(o)		((o)&IPOPT_COPY) | 
|---|
| 49 | #define	IPOPT_CLASS(o)		((o)&IPOPT_CLASS_MASK) | 
|---|
| 50 | #define	IPOPT_NUMBER(o)		((o)&IPOPT_NUMBER_MASK) | 
|---|
| 51 |  | 
|---|
| 52 | #define	IPOPT_CONTROL		0x00 | 
|---|
| 53 | #define	IPOPT_RESERVED1		0x20 | 
|---|
| 54 | #define	IPOPT_MEASUREMENT	0x40 | 
|---|
| 55 | #define	IPOPT_RESERVED2		0x60 | 
|---|
| 56 |  | 
|---|
| 57 | #define IPOPT_END	(0 |IPOPT_CONTROL) | 
|---|
| 58 | #define IPOPT_NOOP	(1 |IPOPT_CONTROL) | 
|---|
| 59 | #define IPOPT_SEC	(2 |IPOPT_CONTROL|IPOPT_COPY) | 
|---|
| 60 | #define IPOPT_LSRR	(3 |IPOPT_CONTROL|IPOPT_COPY) | 
|---|
| 61 | #define IPOPT_TIMESTAMP	(4 |IPOPT_MEASUREMENT) | 
|---|
| 62 | #define IPOPT_CIPSO	(6 |IPOPT_CONTROL|IPOPT_COPY) | 
|---|
| 63 | #define IPOPT_RR	(7 |IPOPT_CONTROL) | 
|---|
| 64 | #define IPOPT_SID	(8 |IPOPT_CONTROL|IPOPT_COPY) | 
|---|
| 65 | #define IPOPT_SSRR	(9 |IPOPT_CONTROL|IPOPT_COPY) | 
|---|
| 66 | #define IPOPT_RA	(20|IPOPT_CONTROL|IPOPT_COPY) | 
|---|
| 67 |  | 
|---|
| 68 | #define IPVERSION	4 | 
|---|
| 69 | #define MAXTTL		255 | 
|---|
| 70 | #define IPDEFTTL	64 | 
|---|
| 71 |  | 
|---|
| 72 | #define IPOPT_OPTVAL 0 | 
|---|
| 73 | #define IPOPT_OLEN   1 | 
|---|
| 74 | #define IPOPT_OFFSET 2 | 
|---|
| 75 | #define IPOPT_MINOFF 4 | 
|---|
| 76 | #define MAX_IPOPTLEN 40 | 
|---|
| 77 | #define IPOPT_NOP IPOPT_NOOP | 
|---|
| 78 | #define IPOPT_EOL IPOPT_END | 
|---|
| 79 | #define IPOPT_TS  IPOPT_TIMESTAMP | 
|---|
| 80 |  | 
|---|
| 81 | #define	IPOPT_TS_TSONLY		0		/* timestamps only */ | 
|---|
| 82 | #define	IPOPT_TS_TSANDADDR	1		/* timestamps and addresses */ | 
|---|
| 83 | #define	IPOPT_TS_PRESPEC	3		/* specified modules only */ | 
|---|
| 84 |  | 
|---|
| 85 | #define IPV4_BEET_PHMAXLEN 8 | 
|---|
| 86 |  | 
|---|
| 87 | struct iphdr { | 
|---|
| 88 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 
|---|
| 89 | __u8	ihl:4, | 
|---|
| 90 | version:4; | 
|---|
| 91 | #elif defined (__BIG_ENDIAN_BITFIELD) | 
|---|
| 92 | __u8	version:4, | 
|---|
| 93 | ihl:4; | 
|---|
| 94 | #else | 
|---|
| 95 | #error	"Please fix <asm/byteorder.h>" | 
|---|
| 96 | #endif | 
|---|
| 97 | __u8	tos; | 
|---|
| 98 | __be16	tot_len; | 
|---|
| 99 | __be16	id; | 
|---|
| 100 | __be16	frag_off; | 
|---|
| 101 | __u8	ttl; | 
|---|
| 102 | __u8	protocol; | 
|---|
| 103 | __sum16	check; | 
|---|
| 104 | __struct_group(/* no tag */, addrs, /* no attrs */, | 
|---|
| 105 | __be32	saddr; | 
|---|
| 106 | __be32	daddr; | 
|---|
| 107 | ); | 
|---|
| 108 | /*The options start here. */ | 
|---|
| 109 | }; | 
|---|
| 110 |  | 
|---|
| 111 |  | 
|---|
| 112 | struct ip_auth_hdr { | 
|---|
| 113 | __u8  nexthdr; | 
|---|
| 114 | __u8  hdrlen;		/* This one is measured in 32 bit units! */ | 
|---|
| 115 | __be16 reserved; | 
|---|
| 116 | __be32 spi; | 
|---|
| 117 | __be32 seq_no;		/* Sequence number */ | 
|---|
| 118 | __u8  auth_data[];	/* Variable len but >=4. Mind the 64 bit alignment! */ | 
|---|
| 119 | }; | 
|---|
| 120 |  | 
|---|
| 121 | struct ip_esp_hdr { | 
|---|
| 122 | __be32 spi; | 
|---|
| 123 | __be32 seq_no;		/* Sequence number */ | 
|---|
| 124 | __u8  enc_data[];	/* Variable len but >=8. Mind the 64 bit alignment! */ | 
|---|
| 125 | }; | 
|---|
| 126 |  | 
|---|
| 127 | struct ip_comp_hdr { | 
|---|
| 128 | __u8 nexthdr; | 
|---|
| 129 | __u8 flags; | 
|---|
| 130 | __be16 cpi; | 
|---|
| 131 | }; | 
|---|
| 132 |  | 
|---|
| 133 | struct ip_beet_phdr { | 
|---|
| 134 | __u8 nexthdr; | 
|---|
| 135 | __u8 hdrlen; | 
|---|
| 136 | __u8 padlen; | 
|---|
| 137 | __u8 reserved; | 
|---|
| 138 | }; | 
|---|
| 139 |  | 
|---|
| 140 | struct ip_iptfs_hdr { | 
|---|
| 141 | __u8 subtype;		/* 0*: basic, 1: CC */ | 
|---|
| 142 | __u8 flags; | 
|---|
| 143 | __be16 block_offset; | 
|---|
| 144 | }; | 
|---|
| 145 |  | 
|---|
| 146 | struct ip_iptfs_cc_hdr { | 
|---|
| 147 | __u8 subtype;		/* 0: basic, 1*: CC */ | 
|---|
| 148 | __u8 flags; | 
|---|
| 149 | __be16 block_offset; | 
|---|
| 150 | __be32 loss_rate; | 
|---|
| 151 | __be64 rtt_adelay_xdelay; | 
|---|
| 152 | __be32 tval; | 
|---|
| 153 | __be32 techo; | 
|---|
| 154 | }; | 
|---|
| 155 |  | 
|---|
| 156 | /* index values for the variables in ipv4_devconf */ | 
|---|
| 157 | enum | 
|---|
| 158 | { | 
|---|
| 159 | IPV4_DEVCONF_FORWARDING=1, | 
|---|
| 160 | IPV4_DEVCONF_MC_FORWARDING, | 
|---|
| 161 | IPV4_DEVCONF_PROXY_ARP, | 
|---|
| 162 | IPV4_DEVCONF_ACCEPT_REDIRECTS, | 
|---|
| 163 | IPV4_DEVCONF_SECURE_REDIRECTS, | 
|---|
| 164 | IPV4_DEVCONF_SEND_REDIRECTS, | 
|---|
| 165 | IPV4_DEVCONF_SHARED_MEDIA, | 
|---|
| 166 | IPV4_DEVCONF_RP_FILTER, | 
|---|
| 167 | IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, | 
|---|
| 168 | IPV4_DEVCONF_BOOTP_RELAY, | 
|---|
| 169 | IPV4_DEVCONF_LOG_MARTIANS, | 
|---|
| 170 | IPV4_DEVCONF_TAG, | 
|---|
| 171 | IPV4_DEVCONF_ARPFILTER, | 
|---|
| 172 | IPV4_DEVCONF_MEDIUM_ID, | 
|---|
| 173 | IPV4_DEVCONF_NOXFRM, | 
|---|
| 174 | IPV4_DEVCONF_NOPOLICY, | 
|---|
| 175 | IPV4_DEVCONF_FORCE_IGMP_VERSION, | 
|---|
| 176 | IPV4_DEVCONF_ARP_ANNOUNCE, | 
|---|
| 177 | IPV4_DEVCONF_ARP_IGNORE, | 
|---|
| 178 | IPV4_DEVCONF_PROMOTE_SECONDARIES, | 
|---|
| 179 | IPV4_DEVCONF_ARP_ACCEPT, | 
|---|
| 180 | IPV4_DEVCONF_ARP_NOTIFY, | 
|---|
| 181 | IPV4_DEVCONF_ACCEPT_LOCAL, | 
|---|
| 182 | IPV4_DEVCONF_SRC_VMARK, | 
|---|
| 183 | IPV4_DEVCONF_PROXY_ARP_PVLAN, | 
|---|
| 184 | IPV4_DEVCONF_ROUTE_LOCALNET, | 
|---|
| 185 | IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL, | 
|---|
| 186 | IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL, | 
|---|
| 187 | IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, | 
|---|
| 188 | IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, | 
|---|
| 189 | IPV4_DEVCONF_DROP_GRATUITOUS_ARP, | 
|---|
| 190 | IPV4_DEVCONF_BC_FORWARDING, | 
|---|
| 191 | IPV4_DEVCONF_ARP_EVICT_NOCARRIER, | 
|---|
| 192 | __IPV4_DEVCONF_MAX | 
|---|
| 193 | }; | 
|---|
| 194 |  | 
|---|
| 195 | #define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1) | 
|---|
| 196 |  | 
|---|
| 197 | #endif /* _UAPI_LINUX_IP_H */ | 
|---|
| 198 |  | 
|---|