1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3607ca46eSDavid Howells * INET An implementation of the TCP/IP protocol suite for the LINUX 4607ca46eSDavid Howells * operating system. INET is implemented using the BSD Socket 5607ca46eSDavid Howells * interface as the means of communication with the user level. 6607ca46eSDavid Howells * 7607ca46eSDavid Howells * Definitions for the IP protocol. 8607ca46eSDavid Howells * 9607ca46eSDavid Howells * Version: @(#)ip.h 1.0.2 04/28/93 10607ca46eSDavid Howells * 11607ca46eSDavid Howells * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 12607ca46eSDavid Howells * 13607ca46eSDavid Howells * This program is free software; you can redistribute it and/or 14607ca46eSDavid Howells * modify it under the terms of the GNU General Public License 15607ca46eSDavid Howells * as published by the Free Software Foundation; either version 16607ca46eSDavid Howells * 2 of the License, or (at your option) any later version. 17607ca46eSDavid Howells */ 18607ca46eSDavid Howells #ifndef _UAPI_LINUX_IP_H 19607ca46eSDavid Howells #define _UAPI_LINUX_IP_H 20607ca46eSDavid Howells #include <linux/types.h> 21607ca46eSDavid Howells #include <asm/byteorder.h> 22607ca46eSDavid Howells 23607ca46eSDavid Howells #define IPTOS_TOS_MASK 0x1E 24607ca46eSDavid Howells #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) 25607ca46eSDavid Howells #define IPTOS_LOWDELAY 0x10 26607ca46eSDavid Howells #define IPTOS_THROUGHPUT 0x08 27607ca46eSDavid Howells #define IPTOS_RELIABILITY 0x04 28607ca46eSDavid Howells #define IPTOS_MINCOST 0x02 29607ca46eSDavid Howells 30607ca46eSDavid Howells #define IPTOS_PREC_MASK 0xE0 31607ca46eSDavid Howells #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) 32607ca46eSDavid Howells #define IPTOS_PREC_NETCONTROL 0xe0 33607ca46eSDavid Howells #define IPTOS_PREC_INTERNETCONTROL 0xc0 34607ca46eSDavid Howells #define IPTOS_PREC_CRITIC_ECP 0xa0 35607ca46eSDavid Howells #define IPTOS_PREC_FLASHOVERRIDE 0x80 36607ca46eSDavid Howells #define IPTOS_PREC_FLASH 0x60 37607ca46eSDavid Howells #define IPTOS_PREC_IMMEDIATE 0x40 38607ca46eSDavid Howells #define IPTOS_PREC_PRIORITY 0x20 39607ca46eSDavid Howells #define IPTOS_PREC_ROUTINE 0x00 40607ca46eSDavid Howells 41607ca46eSDavid Howells 42607ca46eSDavid Howells /* IP options */ 43607ca46eSDavid Howells #define IPOPT_COPY 0x80 44607ca46eSDavid Howells #define IPOPT_CLASS_MASK 0x60 45607ca46eSDavid Howells #define IPOPT_NUMBER_MASK 0x1f 46607ca46eSDavid Howells 47607ca46eSDavid Howells #define IPOPT_COPIED(o) ((o)&IPOPT_COPY) 48607ca46eSDavid Howells #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) 49607ca46eSDavid Howells #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) 50607ca46eSDavid Howells 51607ca46eSDavid Howells #define IPOPT_CONTROL 0x00 52607ca46eSDavid Howells #define IPOPT_RESERVED1 0x20 53607ca46eSDavid Howells #define IPOPT_MEASUREMENT 0x40 54607ca46eSDavid Howells #define IPOPT_RESERVED2 0x60 55607ca46eSDavid Howells 56607ca46eSDavid Howells #define IPOPT_END (0 |IPOPT_CONTROL) 57607ca46eSDavid Howells #define IPOPT_NOOP (1 |IPOPT_CONTROL) 58607ca46eSDavid Howells #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) 59607ca46eSDavid Howells #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) 60607ca46eSDavid Howells #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) 61607ca46eSDavid Howells #define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY) 62607ca46eSDavid Howells #define IPOPT_RR (7 |IPOPT_CONTROL) 63607ca46eSDavid Howells #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) 64607ca46eSDavid Howells #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) 65607ca46eSDavid Howells #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) 66607ca46eSDavid Howells 67607ca46eSDavid Howells #define IPVERSION 4 68607ca46eSDavid Howells #define MAXTTL 255 69607ca46eSDavid Howells #define IPDEFTTL 64 70607ca46eSDavid Howells 71607ca46eSDavid Howells #define IPOPT_OPTVAL 0 72607ca46eSDavid Howells #define IPOPT_OLEN 1 73607ca46eSDavid Howells #define IPOPT_OFFSET 2 74607ca46eSDavid Howells #define IPOPT_MINOFF 4 75607ca46eSDavid Howells #define MAX_IPOPTLEN 40 76607ca46eSDavid Howells #define IPOPT_NOP IPOPT_NOOP 77607ca46eSDavid Howells #define IPOPT_EOL IPOPT_END 78607ca46eSDavid Howells #define IPOPT_TS IPOPT_TIMESTAMP 79607ca46eSDavid Howells 80607ca46eSDavid Howells #define IPOPT_TS_TSONLY 0 /* timestamps only */ 81607ca46eSDavid Howells #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ 82607ca46eSDavid Howells #define IPOPT_TS_PRESPEC 3 /* specified modules only */ 83607ca46eSDavid Howells 84607ca46eSDavid Howells #define IPV4_BEET_PHMAXLEN 8 85607ca46eSDavid Howells 86607ca46eSDavid Howells struct iphdr { 87607ca46eSDavid Howells #if defined(__LITTLE_ENDIAN_BITFIELD) 88607ca46eSDavid Howells __u8 ihl:4, 89607ca46eSDavid Howells version:4; 90607ca46eSDavid Howells #elif defined (__BIG_ENDIAN_BITFIELD) 91607ca46eSDavid Howells __u8 version:4, 92607ca46eSDavid Howells ihl:4; 93607ca46eSDavid Howells #else 94607ca46eSDavid Howells #error "Please fix <asm/byteorder.h>" 95607ca46eSDavid Howells #endif 96607ca46eSDavid Howells __u8 tos; 97607ca46eSDavid Howells __be16 tot_len; 98607ca46eSDavid Howells __be16 id; 99607ca46eSDavid Howells __be16 frag_off; 100607ca46eSDavid Howells __u8 ttl; 101607ca46eSDavid Howells __u8 protocol; 102607ca46eSDavid Howells __sum16 check; 103607ca46eSDavid Howells __be32 saddr; 104607ca46eSDavid Howells __be32 daddr; 105607ca46eSDavid Howells /*The options start here. */ 106607ca46eSDavid Howells }; 107607ca46eSDavid Howells 108607ca46eSDavid Howells 109607ca46eSDavid Howells struct ip_auth_hdr { 110607ca46eSDavid Howells __u8 nexthdr; 111607ca46eSDavid Howells __u8 hdrlen; /* This one is measured in 32 bit units! */ 112607ca46eSDavid Howells __be16 reserved; 113607ca46eSDavid Howells __be32 spi; 114607ca46eSDavid Howells __be32 seq_no; /* Sequence number */ 115607ca46eSDavid Howells __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */ 116607ca46eSDavid Howells }; 117607ca46eSDavid Howells 118607ca46eSDavid Howells struct ip_esp_hdr { 119607ca46eSDavid Howells __be32 spi; 120607ca46eSDavid Howells __be32 seq_no; /* Sequence number */ 121607ca46eSDavid Howells __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */ 122607ca46eSDavid Howells }; 123607ca46eSDavid Howells 124607ca46eSDavid Howells struct ip_comp_hdr { 125607ca46eSDavid Howells __u8 nexthdr; 126607ca46eSDavid Howells __u8 flags; 127607ca46eSDavid Howells __be16 cpi; 128607ca46eSDavid Howells }; 129607ca46eSDavid Howells 130607ca46eSDavid Howells struct ip_beet_phdr { 131607ca46eSDavid Howells __u8 nexthdr; 132607ca46eSDavid Howells __u8 hdrlen; 133607ca46eSDavid Howells __u8 padlen; 134607ca46eSDavid Howells __u8 reserved; 135607ca46eSDavid Howells }; 136607ca46eSDavid Howells 1374a5a8aa6Sstephen hemminger /* index values for the variables in ipv4_devconf */ 1384a5a8aa6Sstephen hemminger enum 1394a5a8aa6Sstephen hemminger { 1404a5a8aa6Sstephen hemminger IPV4_DEVCONF_FORWARDING=1, 1414a5a8aa6Sstephen hemminger IPV4_DEVCONF_MC_FORWARDING, 1424a5a8aa6Sstephen hemminger IPV4_DEVCONF_PROXY_ARP, 1434a5a8aa6Sstephen hemminger IPV4_DEVCONF_ACCEPT_REDIRECTS, 1444a5a8aa6Sstephen hemminger IPV4_DEVCONF_SECURE_REDIRECTS, 1454a5a8aa6Sstephen hemminger IPV4_DEVCONF_SEND_REDIRECTS, 1464a5a8aa6Sstephen hemminger IPV4_DEVCONF_SHARED_MEDIA, 1474a5a8aa6Sstephen hemminger IPV4_DEVCONF_RP_FILTER, 1484a5a8aa6Sstephen hemminger IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE, 1494a5a8aa6Sstephen hemminger IPV4_DEVCONF_BOOTP_RELAY, 1504a5a8aa6Sstephen hemminger IPV4_DEVCONF_LOG_MARTIANS, 1514a5a8aa6Sstephen hemminger IPV4_DEVCONF_TAG, 1524a5a8aa6Sstephen hemminger IPV4_DEVCONF_ARPFILTER, 1534a5a8aa6Sstephen hemminger IPV4_DEVCONF_MEDIUM_ID, 1544a5a8aa6Sstephen hemminger IPV4_DEVCONF_NOXFRM, 1554a5a8aa6Sstephen hemminger IPV4_DEVCONF_NOPOLICY, 1564a5a8aa6Sstephen hemminger IPV4_DEVCONF_FORCE_IGMP_VERSION, 1574a5a8aa6Sstephen hemminger IPV4_DEVCONF_ARP_ANNOUNCE, 1584a5a8aa6Sstephen hemminger IPV4_DEVCONF_ARP_IGNORE, 1594a5a8aa6Sstephen hemminger IPV4_DEVCONF_PROMOTE_SECONDARIES, 1604a5a8aa6Sstephen hemminger IPV4_DEVCONF_ARP_ACCEPT, 1614a5a8aa6Sstephen hemminger IPV4_DEVCONF_ARP_NOTIFY, 1624a5a8aa6Sstephen hemminger IPV4_DEVCONF_ACCEPT_LOCAL, 1634a5a8aa6Sstephen hemminger IPV4_DEVCONF_SRC_VMARK, 1644a5a8aa6Sstephen hemminger IPV4_DEVCONF_PROXY_ARP_PVLAN, 1654a5a8aa6Sstephen hemminger IPV4_DEVCONF_ROUTE_LOCALNET, 166b05930f5SDavid S. Miller IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL, 167b05930f5SDavid S. Miller IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL, 1680eeb075fSAndy Gospodarek IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN, 16912b74dfaSJohannes Berg IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST, 17097daf331SJohannes Berg IPV4_DEVCONF_DROP_GRATUITOUS_ARP, 1714a5a8aa6Sstephen hemminger __IPV4_DEVCONF_MAX 1724a5a8aa6Sstephen hemminger }; 1734a5a8aa6Sstephen hemminger 1744a5a8aa6Sstephen hemminger #define IPV4_DEVCONF_MAX (__IPV4_DEVCONF_MAX - 1) 1754a5a8aa6Sstephen hemminger 176607ca46eSDavid Howells #endif /* _UAPI_LINUX_IP_H */ 177