in.h revision 55205
133965Sjdp/* 233965Sjdp * Copyright (c) 1982, 1986, 1990, 1993 333965Sjdp * The Regents of the University of California. All rights reserved. 433965Sjdp * 533965Sjdp * Redistribution and use in source and binary forms, with or without 633965Sjdp * modification, are permitted provided that the following conditions 733965Sjdp * are met: 833965Sjdp * 1. Redistributions of source code must retain the above copyright 933965Sjdp * notice, this list of conditions and the following disclaimer. 1033965Sjdp * 2. Redistributions in binary form must reproduce the above copyright 1133965Sjdp * notice, this list of conditions and the following disclaimer in the 1233965Sjdp * documentation and/or other materials provided with the distribution. 1333965Sjdp * 3. All advertising materials mentioning features or use of this software 1433965Sjdp * must display the following acknowledgement: 1533965Sjdp * This product includes software developed by the University of 1633965Sjdp * California, Berkeley and its contributors. 1733965Sjdp * 4. Neither the name of the University nor the names of its contributors 1833965Sjdp * may be used to endorse or promote products derived from this software 1933965Sjdp * without specific prior written permission. 2033965Sjdp * 2133965Sjdp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2233965Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2333965Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2433965Sjdp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2533965Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2633965Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2733965Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2838889Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2933965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3033965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3133965Sjdp * SUCH DAMAGE. 3233965Sjdp * 3333965Sjdp * @(#)in.h 8.3 (Berkeley) 1/3/94 3433965Sjdp * $FreeBSD: head/sys/netinet/in.h 55205 1999-12-29 04:46:21Z peter $ 3533965Sjdp */ 3633965Sjdp 3733965Sjdp#ifndef _NETINET_IN_H_ 3833965Sjdp#define _NETINET_IN_H_ 3933965Sjdp 4033965Sjdp/* 4133965Sjdp * Constants and structures defined by the internet system, 4233965Sjdp * Per RFC 790, September 1981, and numerous additions. 4333965Sjdp */ 4433965Sjdp 4533965Sjdp/* 4633965Sjdp * Protocols (RFC 1700) 4733965Sjdp */ 4833965Sjdp#define IPPROTO_IP 0 /* dummy for IP */ 4933965Sjdp#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */ 5033965Sjdp#define IPPROTO_ICMP 1 /* control message protocol */ 5133965Sjdp#define IPPROTO_IGMP 2 /* group mgmt protocol */ 5233965Sjdp#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ 5333965Sjdp#define IPPROTO_IPV4 4 /* IPv4 encapsulation */ 5433965Sjdp#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */ 5533965Sjdp#define IPPROTO_TCP 6 /* tcp */ 5633965Sjdp#define IPPROTO_ST 7 /* Stream protocol II */ 5733965Sjdp#define IPPROTO_EGP 8 /* exterior gateway protocol */ 5833965Sjdp#define IPPROTO_PIGP 9 /* private interior gateway */ 5933965Sjdp#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */ 6060484Sobrien#define IPPROTO_NVPII 11 /* network voice protocol*/ 6133965Sjdp#define IPPROTO_PUP 12 /* pup */ 6233965Sjdp#define IPPROTO_ARGUS 13 /* Argus */ 6333965Sjdp#define IPPROTO_EMCON 14 /* EMCON */ 6433965Sjdp#define IPPROTO_XNET 15 /* Cross Net Debugger */ 6538889Sjdp#define IPPROTO_CHAOS 16 /* Chaos*/ 6638889Sjdp#define IPPROTO_UDP 17 /* user datagram protocol */ 6738889Sjdp#define IPPROTO_MUX 18 /* Multiplexing */ 6833965Sjdp#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */ 6933965Sjdp#define IPPROTO_HMP 20 /* Host Monitoring */ 7033965Sjdp#define IPPROTO_PRM 21 /* Packet Radio Measurement */ 7133965Sjdp#define IPPROTO_IDP 22 /* xns idp */ 7233965Sjdp#define IPPROTO_TRUNK1 23 /* Trunk-1 */ 7333965Sjdp#define IPPROTO_TRUNK2 24 /* Trunk-2 */ 7433965Sjdp#define IPPROTO_LEAF1 25 /* Leaf-1 */ 7533965Sjdp#define IPPROTO_LEAF2 26 /* Leaf-2 */ 7633965Sjdp#define IPPROTO_RDP 27 /* Reliable Data */ 7738889Sjdp#define IPPROTO_IRTP 28 /* Reliable Transaction */ 7838889Sjdp#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ 7938889Sjdp#define IPPROTO_BLT 30 /* Bulk Data Transfer */ 8038889Sjdp#define IPPROTO_NSP 31 /* Network Services */ 8138889Sjdp#define IPPROTO_INP 32 /* Merit Internodal */ 8238889Sjdp#define IPPROTO_SEP 33 /* Sequential Exchange */ 8360484Sobrien#define IPPROTO_3PC 34 /* Third Party Connect */ 8460484Sobrien#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */ 8560484Sobrien#define IPPROTO_XTP 36 /* XTP */ 8633965Sjdp#define IPPROTO_DDP 37 /* Datagram Delivery */ 8733965Sjdp#define IPPROTO_CMTP 38 /* Control Message Transport */ 8833965Sjdp#define IPPROTO_TPXX 39 /* TP++ Transport */ 8933965Sjdp#define IPPROTO_IL 40 /* IL transport protocol */ 9033965Sjdp#define IPPROTO_IPV6 41 /* IP6 header */ 9133965Sjdp#define IPPROTO_SDRP 42 /* Source Demand Routing */ 9233965Sjdp#define IPPROTO_ROUTING 43 /* IP6 routing header */ 9333965Sjdp#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ 9433965Sjdp#define IPPROTO_IDRP 45 /* InterDomain Routing*/ 9533965Sjdp#define IPPROTO_RSVP 46 /* resource reservation */ 9633965Sjdp#define IPPROTO_GRE 47 /* General Routing Encap. */ 9733965Sjdp#define IPPROTO_MHRP 48 /* Mobile Host Routing */ 9833965Sjdp#define IPPROTO_BHA 49 /* BHA */ 9933965Sjdp#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ 10060484Sobrien#define IPPROTO_AH 51 /* IP6 Auth Header */ 10160484Sobrien#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */ 10260484Sobrien#define IPPROTO_SWIPE 53 /* IP with encryption */ 10360484Sobrien#define IPPROTO_NHRP 54 /* Next Hop Resolution */ 10460484Sobrien/* 55-57: Unassigned */ 10560484Sobrien#define IPPROTO_ICMPV6 58 /* ICMP6 */ 10660484Sobrien#define IPPROTO_NONE 59 /* IP6 no next header */ 10760484Sobrien#define IPPROTO_DSTOPTS 60 /* IP6 destination option */ 10860484Sobrien#define IPPROTO_AHIP 61 /* any host internal protocol */ 10960484Sobrien#define IPPROTO_CFTP 62 /* CFTP */ 11060484Sobrien#define IPPROTO_HELLO 63 /* "hello" routing protocol */ 11160484Sobrien#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */ 11260484Sobrien#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */ 11333965Sjdp#define IPPROTO_RVD 66 /* Remote Virtual Disk */ 11433965Sjdp#define IPPROTO_IPPC 67 /* Pluribus Packet Core */ 11533965Sjdp#define IPPROTO_ADFS 68 /* Any distributed FS */ 11633965Sjdp#define IPPROTO_SATMON 69 /* Satnet Monitoring */ 11733965Sjdp#define IPPROTO_VISA 70 /* VISA Protocol */ 11833965Sjdp#define IPPROTO_IPCV 71 /* Packet Core Utility */ 11933965Sjdp#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */ 12033965Sjdp#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */ 12133965Sjdp#define IPPROTO_WSN 74 /* Wang Span Network */ 12233965Sjdp#define IPPROTO_PVP 75 /* Packet Video Protocol */ 12333965Sjdp#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */ 12433965Sjdp#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */ 12533965Sjdp#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */ 12633965Sjdp#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */ 12733965Sjdp#define IPPROTO_EON 80 /* ISO cnlp */ 12833965Sjdp#define IPPROTO_VMTP 81 /* VMTP */ 12933965Sjdp#define IPPROTO_SVMTP 82 /* Secure VMTP */ 13033965Sjdp#define IPPROTO_VINES 83 /* Banyon VINES */ 13133965Sjdp#define IPPROTO_TTP 84 /* TTP */ 13233965Sjdp#define IPPROTO_IGP 85 /* NSFNET-IGP */ 13333965Sjdp#define IPPROTO_DGP 86 /* dissimilar gateway prot. */ 13433965Sjdp#define IPPROTO_TCF 87 /* TCF */ 13533965Sjdp#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */ 13633965Sjdp#define IPPROTO_OSPFIGP 89 /* OSPFIGP */ 13733965Sjdp#define IPPROTO_SRPC 90 /* Strite RPC protocol */ 13833965Sjdp#define IPPROTO_LARP 91 /* Locus Address Resoloution */ 13933965Sjdp#define IPPROTO_MTP 92 /* Multicast Transport */ 14033965Sjdp#define IPPROTO_AX25 93 /* AX.25 Frames */ 14133965Sjdp#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */ 14233965Sjdp#define IPPROTO_MICP 95 /* Mobile Int.ing control */ 14333965Sjdp#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */ 14433965Sjdp#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */ 14533965Sjdp#define IPPROTO_ENCAP 98 /* encapsulation header */ 14633965Sjdp#define IPPROTO_APES 99 /* any private encr. scheme */ 14733965Sjdp#define IPPROTO_GMTP 100 /* GMTP*/ 14833965Sjdp#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */ 14933965Sjdp/* 101-254: Partly Unassigned */ 15033965Sjdp#define IPPROTO_PIM 103 /* Protocol Independent Mcast */ 15133965Sjdp#define IPPROTO_PGM 113 /* PGM */ 15233965Sjdp/* 255: Reserved */ 15333965Sjdp/* BSD Private, local use, namespace incursion */ 15433965Sjdp#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */ 15533965Sjdp#define IPPROTO_RAW 255 /* raw IP packet */ 15633965Sjdp#define IPPROTO_MAX 256 15733965Sjdp 15833965Sjdp/* last return value of *_input(), meaning "all job for this pkt is done". */ 15933965Sjdp#define IPPROTO_DONE 257 16033965Sjdp 16133965Sjdp/* 16233965Sjdp * Local port number conventions: 16333965Sjdp * 16433965Sjdp * When a user does a bind(2) or connect(2) with a port number of zero, 16533965Sjdp * a non-conflicting local port address is chosen. 16633965Sjdp * The default range is IPPORT_RESERVED through 16733965Sjdp * IPPORT_USERRESERVED, although that is settable by sysctl. 16833965Sjdp * 16933965Sjdp * A user may set the IPPROTO_IP option IP_PORTRANGE to change this 17033965Sjdp * default assignment range. 17133965Sjdp * 17233965Sjdp * The value IP_PORTRANGE_DEFAULT causes the default behavior. 17333965Sjdp * 17433965Sjdp * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers 17533965Sjdp * into the "high" range. These are reserved for client outbound connections 17633965Sjdp * which do not want to be filtered by any firewalls. 17733965Sjdp * 17833965Sjdp * The value IP_PORTRANGE_LOW changes the range to the "low" are 17933965Sjdp * that is (by convention) restricted to privileged processes. This 18033965Sjdp * convention is based on "vouchsafe" principles only. It is only secure 18133965Sjdp * if you trust the remote host to restrict these ports. 18233965Sjdp * 18333965Sjdp * The default range of ports and the high range can be changed by 18433965Sjdp * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) 18533965Sjdp * 18633965Sjdp * Changing those values has bad security implications if you are 18760484Sobrien * using a a stateless firewall that is allowing packets outside of that 18860484Sobrien * range in order to allow transparent outgoing connections. 18960484Sobrien * 19060484Sobrien * Such a firewall configuration will generally depend on the use of these 19133965Sjdp * default values. If you change them, you may find your Security 19233965Sjdp * Administrator looking for you with a heavy object. 19333965Sjdp * 19433965Sjdp * For a slightly more orthodox text view on this: 19533965Sjdp * 19633965Sjdp * ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers 19733965Sjdp * 19833965Sjdp * port numbers are divided into three ranges: 19933965Sjdp * 20033965Sjdp * 0 - 1023 Well Known Ports 20133965Sjdp * 1024 - 49151 Registered Ports 20233965Sjdp * 49152 - 65535 Dynamic and/or Private Ports 20333965Sjdp * 20433965Sjdp */ 20533965Sjdp 20633965Sjdp/* 20733965Sjdp * Ports < IPPORT_RESERVED are reserved for 20860484Sobrien * privileged processes (e.g. root). (IP_PORTRANGE_LOW) 20933965Sjdp * Ports > IPPORT_USERRESERVED are reserved 21033965Sjdp * for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT) 21133965Sjdp */ 21233965Sjdp#define IPPORT_RESERVED 1024 21333965Sjdp#define IPPORT_USERRESERVED 5000 21433965Sjdp 21533965Sjdp/* 21633965Sjdp * Default local port range to use by setting IP_PORTRANGE_HIGH 21733965Sjdp */ 21833965Sjdp#define IPPORT_HIFIRSTAUTO 49152 21933965Sjdp#define IPPORT_HILASTAUTO 65535 22033965Sjdp 22133965Sjdp/* 22233965Sjdp * Scanning for a free reserved port return a value below IPPORT_RESERVED, 22333965Sjdp * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was 22433965Sjdp * 512, but that conflicts with some well-known-services that firewalls may 22533965Sjdp * have a fit if we use. 22633965Sjdp */ 22733965Sjdp#define IPPORT_RESERVEDSTART 600 22833965Sjdp 22933965Sjdp/* 23033965Sjdp * Internet address (a structure for historical reasons) 23160484Sobrien */ 23260484Sobrienstruct in_addr { 23360484Sobrien u_int32_t s_addr; 23433965Sjdp}; 23533965Sjdp 23633965Sjdp/* 23733965Sjdp * Definitions of bits in internet address integers. 23833965Sjdp * On subnets, the decomposition of addresses to host and net parts 23933965Sjdp * is done according to subnet mask, not the masks here. 24060484Sobrien */ 24160484Sobrien#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0) 24260484Sobrien#define IN_CLASSA_NET 0xff000000 24333965Sjdp#define IN_CLASSA_NSHIFT 24 24433965Sjdp#define IN_CLASSA_HOST 0x00ffffff 24533965Sjdp#define IN_CLASSA_MAX 128 24633965Sjdp 24733965Sjdp#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000) 24833965Sjdp#define IN_CLASSB_NET 0xffff0000 24933965Sjdp#define IN_CLASSB_NSHIFT 16 25033965Sjdp#define IN_CLASSB_HOST 0x0000ffff 25133965Sjdp#define IN_CLASSB_MAX 65536 25233965Sjdp 25333965Sjdp#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000) 25433965Sjdp#define IN_CLASSC_NET 0xffffff00 25533965Sjdp#define IN_CLASSC_NSHIFT 8 25633965Sjdp#define IN_CLASSC_HOST 0x000000ff 25733965Sjdp 25833965Sjdp#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000) 25933965Sjdp#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ 26033965Sjdp#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ 26133965Sjdp#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ 26233965Sjdp#define IN_MULTICAST(i) IN_CLASSD(i) 26333965Sjdp 26433965Sjdp#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) 26533965Sjdp#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) 26633965Sjdp 26733965Sjdp#define INADDR_ANY (u_int32_t)0x00000000 26833965Sjdp#define INADDR_LOOPBACK (u_int32_t)0x7f000001 26933965Sjdp#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */ 27033965Sjdp#ifndef _KERNEL 27133965Sjdp#define INADDR_NONE 0xffffffff /* -1 return */ 27233965Sjdp#endif 27333965Sjdp 27433965Sjdp#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */ 27533965Sjdp#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */ 27633965Sjdp#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */ 27733965Sjdp#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */ 27833965Sjdp 27933965Sjdp#define IN_LOOPBACKNET 127 /* official! */ 28033965Sjdp 28133965Sjdp/* 28233965Sjdp * Socket address, internet style. 28333965Sjdp */ 28433965Sjdpstruct sockaddr_in { 28533965Sjdp u_char sin_len; 28633965Sjdp u_char sin_family; 28733965Sjdp u_short sin_port; 28833965Sjdp struct in_addr sin_addr; 28933965Sjdp char sin_zero[8]; 29033965Sjdp}; 29133965Sjdp 29233965Sjdp#define INET_ADDRSTRLEN 16 29333965Sjdp 29460484Sobrien/* 29560484Sobrien * Structure used to describe IP options. 29660484Sobrien * Used to store options internally, to pass them to a process, 29760484Sobrien * or to restore options retrieved earlier. 29860484Sobrien * The ip_dst is used for the first-hop gateway when using a source route 29960484Sobrien * (this gets put into the header proper). 30060484Sobrien */ 30160484Sobrienstruct ip_opts { 30260484Sobrien struct in_addr ip_dst; /* first hop, 0 w/o src rt */ 30360484Sobrien char ip_opts[40]; /* actually variable in size */ 30460484Sobrien}; 30560484Sobrien 30660484Sobrien/* 30760484Sobrien * Options for use with [gs]etsockopt at the IP level. 30860484Sobrien * First word of comment is data type; bool is stored in int. 30960484Sobrien */ 31060484Sobrien#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ 31160484Sobrien#define IP_HDRINCL 2 /* int; header is included with data */ 31260484Sobrien#define IP_TOS 3 /* int; IP type of service and preced. */ 31360484Sobrien#define IP_TTL 4 /* int; IP time to live */ 31460484Sobrien#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ 31533965Sjdp#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ 31660484Sobrien#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ 31760484Sobrien#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ 31860484Sobrien#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ 31960484Sobrien#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ 32060484Sobrien#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ 32160484Sobrien#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ 32260484Sobrien#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ 32360484Sobrien#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ 32460484Sobrien#define IP_RSVP_ON 15 /* enable RSVP in kernel */ 32560484Sobrien#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ 32660484Sobrien#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ 32760484Sobrien#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ 32860484Sobrien#define IP_PORTRANGE 19 /* int; range to choose for unspec port */ 32960484Sobrien#define IP_RECVIF 20 /* bool; receive reception if w/dgram */ 33060484Sobrien/* for IPSEC */ 33160484Sobrien#define IP_IPSEC_POLICY 21 /* int; set/get security policy */ 33260484Sobrien#define IP_FAITH 22 /* bool; accept FAITH'ed connections */ 33360484Sobrien 33460484Sobrien#define IP_FW_ADD 50 /* add a firewall rule to chain */ 33560484Sobrien#define IP_FW_DEL 51 /* delete a firewall rule from chain */ 33660484Sobrien#define IP_FW_FLUSH 52 /* flush firewall rule chain */ 33760484Sobrien#define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ 33860484Sobrien#define IP_FW_GET 54 /* get entire firewall rule chain */ 33933965Sjdp#define IP_FW_RESETLOG 55 /* reset logging counters */ 34033965Sjdp 34133965Sjdp#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */ 34233965Sjdp#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */ 34333965Sjdp#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */ 34433965Sjdp#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */ 34533965Sjdp 34633965Sjdp/* 34733965Sjdp * Defaults and limits for options 34833965Sjdp */ 34933965Sjdp#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ 35033965Sjdp#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ 35160484Sobrien#define IP_MAX_MEMBERSHIPS 20 /* per socket */ 35260484Sobrien 35360484Sobrien/* 35460484Sobrien * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. 35533965Sjdp */ 35633965Sjdpstruct ip_mreq { 35733965Sjdp struct in_addr imr_multiaddr; /* IP multicast address of group */ 35833965Sjdp struct in_addr imr_interface; /* local IP address of interface */ 35933965Sjdp}; 36033965Sjdp 36133965Sjdp/* 36233965Sjdp * Argument for IP_PORTRANGE: 36333965Sjdp * - which range to search when port is unspecified at bind() or connect() 36433965Sjdp */ 36533965Sjdp#define IP_PORTRANGE_DEFAULT 0 /* default range */ 36633965Sjdp#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ 36733965Sjdp#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ 36860484Sobrien 36933965Sjdp/* 37033965Sjdp * Definitions for inet sysctl operations. 37160484Sobrien * 37233965Sjdp * Third level is protocol number. 37333965Sjdp * Fourth level is desired variable within that protocol. 37433965Sjdp */ 37533965Sjdp#define IPPROTO_MAXID (IPPROTO_ESP + 1) /* don't list to IPPROTO_MAX */ 37633965Sjdp 37733965Sjdp#define CTL_IPPROTO_NAMES { \ 37833965Sjdp { "ip", CTLTYPE_NODE }, \ 37933965Sjdp { "icmp", CTLTYPE_NODE }, \ 38033965Sjdp { "igmp", CTLTYPE_NODE }, \ 38133965Sjdp { "ggp", CTLTYPE_NODE }, \ 38233965Sjdp { 0, 0 }, \ 38333965Sjdp { 0, 0 }, \ 38433965Sjdp { "tcp", CTLTYPE_NODE }, \ 38533965Sjdp { 0, 0 }, \ 38633965Sjdp { "egp", CTLTYPE_NODE }, \ 38733965Sjdp { 0, 0 }, \ 38860484Sobrien { 0, 0 }, \ 38960484Sobrien { 0, 0 }, \ 39060484Sobrien { "pup", CTLTYPE_NODE }, \ 39160484Sobrien { 0, 0 }, \ 39260484Sobrien { 0, 0 }, \ 39360484Sobrien { 0, 0 }, \ 39460484Sobrien { 0, 0 }, \ 39533965Sjdp { "udp", CTLTYPE_NODE }, \ 39633965Sjdp { 0, 0 }, \ 39733965Sjdp { 0, 0 }, \ 39833965Sjdp { 0, 0 }, \ 39938889Sjdp { 0, 0 }, \ 40060484Sobrien { "idp", CTLTYPE_NODE }, \ 40160484Sobrien} 40260484Sobrien 40360484Sobrien/* 40460484Sobrien * Names for IP sysctl objects 40560484Sobrien */ 40660484Sobrien#define IPCTL_FORWARDING 1 /* act as router */ 40760484Sobrien#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ 40833965Sjdp#define IPCTL_DEFTTL 3 /* default TTL */ 40933965Sjdp#ifdef notyet 41038889Sjdp#define IPCTL_DEFMTU 4 /* default MTU */ 41138889Sjdp#endif 41260484Sobrien#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ 41360484Sobrien#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ 41460484Sobrien#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ 41533965Sjdp#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ 41633965Sjdp#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ 41760484Sobrien#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ 41860484Sobrien#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ 41960484Sobrien#define IPCTL_STATS 12 /* ipstat structure */ 42060484Sobrien#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ 42160484Sobrien#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */ 42233965Sjdp#define IPCTL_KEEPFAITH 15 /* FAITH IPv4->IPv6 translater ctl */ 42333965Sjdp#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */ 42433965Sjdp#define IPCTL_MAXID 17 42533965Sjdp 42633965Sjdp#define IPCTL_NAMES { \ 42733965Sjdp { 0, 0 }, \ 42833965Sjdp { "forwarding", CTLTYPE_INT }, \ 42933965Sjdp { "redirect", CTLTYPE_INT }, \ 43033965Sjdp { "ttl", CTLTYPE_INT }, \ 43133965Sjdp { "mtu", CTLTYPE_INT }, \ 43233965Sjdp { "rtexpire", CTLTYPE_INT }, \ 43333965Sjdp { "rtminexpire", CTLTYPE_INT }, \ 43433965Sjdp { "rtmaxcache", CTLTYPE_INT }, \ 43533965Sjdp { "sourceroute", CTLTYPE_INT }, \ 43633965Sjdp { "directed-broadcast", CTLTYPE_INT }, \ 43733965Sjdp { "intr-queue-maxlen", CTLTYPE_INT }, \ 43833965Sjdp { "intr-queue-drops", CTLTYPE_INT }, \ 43933965Sjdp { "stats", CTLTYPE_STRUCT }, \ 44033965Sjdp { "accept_sourceroute", CTLTYPE_INT }, \ 44133965Sjdp { "fastforwarding", CTLTYPE_INT }, \ 44233965Sjdp} 44333965Sjdp 44433965Sjdp/* INET6 stuff */ 44533965Sjdp#include <netinet6/in6.h> 44633965Sjdp 44733965Sjdp#ifdef _KERNEL 44833965Sjdpstruct ifnet; struct mbuf; /* forward declarations for Standard C */ 44933965Sjdpstruct proc; 45033965Sjdp 45133965Sjdpint in_broadcast __P((struct in_addr, struct ifnet *)); 45233965Sjdpint in_canforward __P((struct in_addr)); 45333965Sjdpint in_cksum __P((struct mbuf *, int)); 45433965Sjdpint in_localaddr __P((struct in_addr)); 45533965Sjdpchar *inet_ntoa __P((struct in_addr)); /* in libkern */ 45633965Sjdp 45733965Sjdpint prison_ip __P((struct proc *p, int flag, u_int32_t *ip)); 45833965Sjdpvoid prison_remote_ip __P((struct proc *p, int flag, u_int32_t *ip)); 45933965Sjdp 46033965Sjdp#endif 46133965Sjdp 46233965Sjdp#endif 46333965Sjdp