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