1df8bae1dSRodney W. Grimes /* 2df8bae1dSRodney W. Grimes * Copyright (c) 1982, 1986, 1990, 1993 3df8bae1dSRodney W. Grimes * The Regents of the University of California. All rights reserved. 4df8bae1dSRodney W. Grimes * 5df8bae1dSRodney W. Grimes * Redistribution and use in source and binary forms, with or without 6df8bae1dSRodney W. Grimes * modification, are permitted provided that the following conditions 7df8bae1dSRodney W. Grimes * are met: 8df8bae1dSRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 9df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer. 10df8bae1dSRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 11df8bae1dSRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 12df8bae1dSRodney W. Grimes * documentation and/or other materials provided with the distribution. 13df8bae1dSRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 14df8bae1dSRodney W. Grimes * must display the following acknowledgement: 15df8bae1dSRodney W. Grimes * This product includes software developed by the University of 16df8bae1dSRodney W. Grimes * California, Berkeley and its contributors. 17df8bae1dSRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 18df8bae1dSRodney W. Grimes * may be used to endorse or promote products derived from this software 19df8bae1dSRodney W. Grimes * without specific prior written permission. 20df8bae1dSRodney W. Grimes * 21df8bae1dSRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22df8bae1dSRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23df8bae1dSRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24df8bae1dSRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25df8bae1dSRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26df8bae1dSRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27df8bae1dSRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28df8bae1dSRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29df8bae1dSRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30df8bae1dSRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31df8bae1dSRodney W. Grimes * SUCH DAMAGE. 32df8bae1dSRodney W. Grimes * 33df8bae1dSRodney W. Grimes * @(#)in.h 8.3 (Berkeley) 1/3/94 344fce5804SGuido van Rooij * $Id: in.h,v 1.27 1997/09/25 00:34:35 wollman Exp $ 35df8bae1dSRodney W. Grimes */ 36df8bae1dSRodney W. Grimes 37707f139eSPaul Richards #ifndef _NETINET_IN_H_ 38707f139eSPaul Richards #define _NETINET_IN_H_ 39707f139eSPaul Richards 40df8bae1dSRodney W. Grimes /* 41df8bae1dSRodney W. Grimes * Constants and structures defined by the internet system, 42df8bae1dSRodney W. Grimes * Per RFC 790, September 1981, and numerous additions. 43df8bae1dSRodney W. Grimes */ 44df8bae1dSRodney W. Grimes 45df8bae1dSRodney W. Grimes /* 46df8bae1dSRodney W. Grimes * Protocols 47df8bae1dSRodney W. Grimes */ 48df8bae1dSRodney W. Grimes #define IPPROTO_IP 0 /* dummy for IP */ 49df8bae1dSRodney W. Grimes #define IPPROTO_ICMP 1 /* control message protocol */ 50df8bae1dSRodney W. Grimes #define IPPROTO_IGMP 2 /* group mgmt protocol */ 51df8bae1dSRodney W. Grimes #define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ 521c5de19aSGarrett Wollman #define IPPROTO_IPIP 4 /* IP encapsulation in IP */ 53df8bae1dSRodney W. Grimes #define IPPROTO_TCP 6 /* tcp */ 54df8bae1dSRodney W. Grimes #define IPPROTO_EGP 8 /* exterior gateway protocol */ 55df8bae1dSRodney W. Grimes #define IPPROTO_PUP 12 /* pup */ 56df8bae1dSRodney W. Grimes #define IPPROTO_UDP 17 /* user datagram protocol */ 57df8bae1dSRodney W. Grimes #define IPPROTO_IDP 22 /* xns idp */ 58df8bae1dSRodney W. Grimes #define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ 59f0068c4aSGarrett Wollman #define IPPROTO_RSVP 46 /* resource reservation */ 60df8bae1dSRodney W. Grimes #define IPPROTO_EON 80 /* ISO cnlp */ 61df8bae1dSRodney W. Grimes #define IPPROTO_ENCAP 98 /* encapsulation header */ 62df8bae1dSRodney W. Grimes 6393e0e116SJulian Elischer #define IPPROTO_DIVERT 254 /* divert pseudo-protocol */ 64df8bae1dSRodney W. Grimes #define IPPROTO_RAW 255 /* raw IP packet */ 65df8bae1dSRodney W. Grimes #define IPPROTO_MAX 256 66df8bae1dSRodney W. Grimes 67df8bae1dSRodney W. Grimes 68df8bae1dSRodney W. Grimes /* 69df8bae1dSRodney W. Grimes * Local port number conventions: 7033b3ac06SPeter Wemm * 7133b3ac06SPeter Wemm * When a user does a bind(2) or connect(2) with a port number of zero, 7233b3ac06SPeter Wemm * a non-conflicting local port address is chosen. 7333b3ac06SPeter Wemm * The default range is IPPORT_RESERVED through 7433b3ac06SPeter Wemm * IPPORT_USERRESERVED, although that is settable by sysctl. 7533b3ac06SPeter Wemm * 7633b3ac06SPeter Wemm * A user may set the IPPROTO_IP option IP_PORTRANGE to change this 7733b3ac06SPeter Wemm * default assignment range. 7833b3ac06SPeter Wemm * 7933b3ac06SPeter Wemm * The value IP_PORTRANGE_DEFAULT causes the default behavior. 8033b3ac06SPeter Wemm * 8133b3ac06SPeter Wemm * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers 8233b3ac06SPeter Wemm * into the "high" range. These are reserved for client outbound connections 8333b3ac06SPeter Wemm * which do not want to be filtered by any firewalls. 8433b3ac06SPeter Wemm * 8533b3ac06SPeter Wemm * The value IP_PORTRANGE_LOW changes the range to the "low" are 8633b3ac06SPeter Wemm * that is (by convention) restricted to privileged processes. This 8733b3ac06SPeter Wemm * convention is based on "vouchsafe" principles only. It is only secure 8833b3ac06SPeter Wemm * if you trust the remote host to restrict these ports. 8933b3ac06SPeter Wemm * 9033b3ac06SPeter Wemm * The default range of ports and the high range can be changed by 91bbd42ad0SPeter Wemm * sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto) 9233b3ac06SPeter Wemm * 9333b3ac06SPeter Wemm * Changing those values has bad security implications if you are 9433b3ac06SPeter Wemm * using a a stateless firewall that is allowing packets outside of that 9533b3ac06SPeter Wemm * range in order to allow transparent outgoing connections. 9633b3ac06SPeter Wemm * 9733b3ac06SPeter Wemm * Such a firewall configuration will generally depend on the use of these 9833b3ac06SPeter Wemm * default values. If you change them, you may find your Security 9933b3ac06SPeter Wemm * Administrator looking for you with a heavy object. 10033b3ac06SPeter Wemm */ 10133b3ac06SPeter Wemm 10233b3ac06SPeter Wemm /* 103df8bae1dSRodney W. Grimes * Ports < IPPORT_RESERVED are reserved for 10433b3ac06SPeter Wemm * privileged processes (e.g. root). (IP_PORTRANGE_LOW) 105df8bae1dSRodney W. Grimes * Ports > IPPORT_USERRESERVED are reserved 10633b3ac06SPeter Wemm * for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT) 107df8bae1dSRodney W. Grimes */ 108df8bae1dSRodney W. Grimes #define IPPORT_RESERVED 1024 109df8bae1dSRodney W. Grimes #define IPPORT_USERRESERVED 5000 110df8bae1dSRodney W. Grimes 111df8bae1dSRodney W. Grimes /* 11233b3ac06SPeter Wemm * Default local port range to use by setting IP_PORTRANGE_HIGH 113101f9fc8SPeter Wemm */ 11433b3ac06SPeter Wemm #define IPPORT_HIFIRSTAUTO 40000 11533b3ac06SPeter Wemm #define IPPORT_HILASTAUTO 44999 116101f9fc8SPeter Wemm 117101f9fc8SPeter Wemm /* 118bbd42ad0SPeter Wemm * Scanning for a free reserved port return a value below IPPORT_RESERVED, 119bbd42ad0SPeter Wemm * but higher than IPPORT_RESERVEDSTART. Traditionally the start value was 120bbd42ad0SPeter Wemm * 512, but that conflicts with some well-known-services that firewalls may 121bbd42ad0SPeter Wemm * have a fit if we use. 122bbd42ad0SPeter Wemm */ 123bbd42ad0SPeter Wemm #define IPPORT_RESERVEDSTART 600 124bbd42ad0SPeter Wemm 125bbd42ad0SPeter Wemm /* 126df8bae1dSRodney W. Grimes * Internet address (a structure for historical reasons) 127df8bae1dSRodney W. Grimes */ 128df8bae1dSRodney W. Grimes struct in_addr { 129df8bae1dSRodney W. Grimes u_long s_addr; 130df8bae1dSRodney W. Grimes }; 131df8bae1dSRodney W. Grimes 132df8bae1dSRodney W. Grimes /* 133df8bae1dSRodney W. Grimes * Definitions of bits in internet address integers. 134df8bae1dSRodney W. Grimes * On subnets, the decomposition of addresses to host and net parts 135df8bae1dSRodney W. Grimes * is done according to subnet mask, not the masks here. 136df8bae1dSRodney W. Grimes */ 137df8bae1dSRodney W. Grimes #define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) 138df8bae1dSRodney W. Grimes #define IN_CLASSA_NET 0xff000000 139df8bae1dSRodney W. Grimes #define IN_CLASSA_NSHIFT 24 140df8bae1dSRodney W. Grimes #define IN_CLASSA_HOST 0x00ffffff 141df8bae1dSRodney W. Grimes #define IN_CLASSA_MAX 128 142df8bae1dSRodney W. Grimes 143df8bae1dSRodney W. Grimes #define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) 144df8bae1dSRodney W. Grimes #define IN_CLASSB_NET 0xffff0000 145df8bae1dSRodney W. Grimes #define IN_CLASSB_NSHIFT 16 146df8bae1dSRodney W. Grimes #define IN_CLASSB_HOST 0x0000ffff 147df8bae1dSRodney W. Grimes #define IN_CLASSB_MAX 65536 148df8bae1dSRodney W. Grimes 149df8bae1dSRodney W. Grimes #define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) 150df8bae1dSRodney W. Grimes #define IN_CLASSC_NET 0xffffff00 151df8bae1dSRodney W. Grimes #define IN_CLASSC_NSHIFT 8 152df8bae1dSRodney W. Grimes #define IN_CLASSC_HOST 0x000000ff 153df8bae1dSRodney W. Grimes 154df8bae1dSRodney W. Grimes #define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) 155df8bae1dSRodney W. Grimes #define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ 156df8bae1dSRodney W. Grimes #define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ 157df8bae1dSRodney W. Grimes #define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ 158df8bae1dSRodney W. Grimes #define IN_MULTICAST(i) IN_CLASSD(i) 159df8bae1dSRodney W. Grimes 160df8bae1dSRodney W. Grimes #define IN_EXPERIMENTAL(i) (((long)(i) & 0xf0000000) == 0xf0000000) 161df8bae1dSRodney W. Grimes #define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) 162df8bae1dSRodney W. Grimes 163df8bae1dSRodney W. Grimes #define INADDR_ANY (u_long)0x00000000 164c922550cSPeter Wemm #define INADDR_LOOPBACK (u_long)0x7f000001 165df8bae1dSRodney W. Grimes #define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ 166df8bae1dSRodney W. Grimes #ifndef KERNEL 167df8bae1dSRodney W. Grimes #define INADDR_NONE 0xffffffff /* -1 return */ 168df8bae1dSRodney W. Grimes #endif 169df8bae1dSRodney W. Grimes 170df8bae1dSRodney W. Grimes #define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ 171df8bae1dSRodney W. Grimes #define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ 17249fa849bSBill Fenner #define INADDR_ALLRTRS_GROUP (u_long)0xe0000002 /* 224.0.0.2 */ 173df8bae1dSRodney W. Grimes #define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ 174df8bae1dSRodney W. Grimes 175df8bae1dSRodney W. Grimes #define IN_LOOPBACKNET 127 /* official! */ 176df8bae1dSRodney W. Grimes 177df8bae1dSRodney W. Grimes /* 178df8bae1dSRodney W. Grimes * Socket address, internet style. 179df8bae1dSRodney W. Grimes */ 180df8bae1dSRodney W. Grimes struct sockaddr_in { 181df8bae1dSRodney W. Grimes u_char sin_len; 182df8bae1dSRodney W. Grimes u_char sin_family; 183df8bae1dSRodney W. Grimes u_short sin_port; 184df8bae1dSRodney W. Grimes struct in_addr sin_addr; 185df8bae1dSRodney W. Grimes char sin_zero[8]; 186df8bae1dSRodney W. Grimes }; 187df8bae1dSRodney W. Grimes 188df8bae1dSRodney W. Grimes /* 189df8bae1dSRodney W. Grimes * Structure used to describe IP options. 190df8bae1dSRodney W. Grimes * Used to store options internally, to pass them to a process, 191df8bae1dSRodney W. Grimes * or to restore options retrieved earlier. 192df8bae1dSRodney W. Grimes * The ip_dst is used for the first-hop gateway when using a source route 193df8bae1dSRodney W. Grimes * (this gets put into the header proper). 194df8bae1dSRodney W. Grimes */ 195df8bae1dSRodney W. Grimes struct ip_opts { 196df8bae1dSRodney W. Grimes struct in_addr ip_dst; /* first hop, 0 w/o src rt */ 197df8bae1dSRodney W. Grimes char ip_opts[40]; /* actually variable in size */ 198df8bae1dSRodney W. Grimes }; 199df8bae1dSRodney W. Grimes 200df8bae1dSRodney W. Grimes /* 201df8bae1dSRodney W. Grimes * Options for use with [gs]etsockopt at the IP level. 202df8bae1dSRodney W. Grimes * First word of comment is data type; bool is stored in int. 203df8bae1dSRodney W. Grimes */ 204df8bae1dSRodney W. Grimes #define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ 205df8bae1dSRodney W. Grimes #define IP_HDRINCL 2 /* int; header is included with data */ 206df8bae1dSRodney W. Grimes #define IP_TOS 3 /* int; IP type of service and preced. */ 207df8bae1dSRodney W. Grimes #define IP_TTL 4 /* int; IP time to live */ 208df8bae1dSRodney W. Grimes #define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ 209df8bae1dSRodney W. Grimes #define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ 210df8bae1dSRodney W. Grimes #define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ 211df8bae1dSRodney W. Grimes #define IP_RETOPTS 8 /* ip_opts; set/get IP options */ 212df8bae1dSRodney W. Grimes #define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ 213df8bae1dSRodney W. Grimes #define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ 214df8bae1dSRodney W. Grimes #define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ 215df8bae1dSRodney W. Grimes #define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ 216df8bae1dSRodney W. Grimes #define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ 217f0068c4aSGarrett Wollman #define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ 218f0068c4aSGarrett Wollman #define IP_RSVP_ON 15 /* enable RSVP in kernel */ 219f0068c4aSGarrett Wollman #define IP_RSVP_OFF 16 /* disable RSVP in kernel */ 2201c5de19aSGarrett Wollman #define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ 2211c5de19aSGarrett Wollman #define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ 22233b3ac06SPeter Wemm #define IP_PORTRANGE 19 /* int; range to choose for unspec port */ 22382c23ebaSBill Fenner #define IP_RECVIF 20 /* bool; receive reception if w/dgram */ 224df8bae1dSRodney W. Grimes 225fed1c7e9SSøren Schmidt #define IP_FW_ADD 50 /* add a firewall rule to chain */ 226fed1c7e9SSøren Schmidt #define IP_FW_DEL 51 /* delete a firewall rule from chain */ 227fed1c7e9SSøren Schmidt #define IP_FW_FLUSH 52 /* flush firewall rule chain */ 228af44ef0aSAlexander Langer #define IP_FW_ZERO 53 /* clear single/all firewall counter(s) */ 229fed1c7e9SSøren Schmidt #define IP_FW_GET 54 /* get entire firewall rule chain */ 230fed1c7e9SSøren Schmidt #define IP_NAT 55 /* set/get NAT opts */ 231fed1c7e9SSøren Schmidt 232df8bae1dSRodney W. Grimes /* 233df8bae1dSRodney W. Grimes * Defaults and limits for options 234df8bae1dSRodney W. Grimes */ 235df8bae1dSRodney W. Grimes #define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ 236df8bae1dSRodney W. Grimes #define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ 2371c5de19aSGarrett Wollman #define IP_MAX_MEMBERSHIPS 20 /* per socket */ 238df8bae1dSRodney W. Grimes 239df8bae1dSRodney W. Grimes /* 240df8bae1dSRodney W. Grimes * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. 241df8bae1dSRodney W. Grimes */ 242df8bae1dSRodney W. Grimes struct ip_mreq { 243df8bae1dSRodney W. Grimes struct in_addr imr_multiaddr; /* IP multicast address of group */ 244df8bae1dSRodney W. Grimes struct in_addr imr_interface; /* local IP address of interface */ 245df8bae1dSRodney W. Grimes }; 246df8bae1dSRodney W. Grimes 247df8bae1dSRodney W. Grimes /* 24833b3ac06SPeter Wemm * Argument for IP_PORTRANGE: 24933b3ac06SPeter Wemm * - which range to search when port is unspecified at bind() or connect() 25033b3ac06SPeter Wemm */ 25133b3ac06SPeter Wemm #define IP_PORTRANGE_DEFAULT 0 /* default range */ 25233b3ac06SPeter Wemm #define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */ 25333b3ac06SPeter Wemm #define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */ 25433b3ac06SPeter Wemm 25533b3ac06SPeter Wemm /* 256df8bae1dSRodney W. Grimes * Definitions for inet sysctl operations. 257df8bae1dSRodney W. Grimes * 258df8bae1dSRodney W. Grimes * Third level is protocol number. 259df8bae1dSRodney W. Grimes * Fourth level is desired variable within that protocol. 260df8bae1dSRodney W. Grimes */ 261df8bae1dSRodney W. Grimes #define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */ 262df8bae1dSRodney W. Grimes 263df8bae1dSRodney W. Grimes #define CTL_IPPROTO_NAMES { \ 264df8bae1dSRodney W. Grimes { "ip", CTLTYPE_NODE }, \ 265df8bae1dSRodney W. Grimes { "icmp", CTLTYPE_NODE }, \ 266df8bae1dSRodney W. Grimes { "igmp", CTLTYPE_NODE }, \ 267df8bae1dSRodney W. Grimes { "ggp", CTLTYPE_NODE }, \ 268df8bae1dSRodney W. Grimes { 0, 0 }, \ 269df8bae1dSRodney W. Grimes { 0, 0 }, \ 270df8bae1dSRodney W. Grimes { "tcp", CTLTYPE_NODE }, \ 271df8bae1dSRodney W. Grimes { 0, 0 }, \ 272df8bae1dSRodney W. Grimes { "egp", CTLTYPE_NODE }, \ 273df8bae1dSRodney W. Grimes { 0, 0 }, \ 274df8bae1dSRodney W. Grimes { 0, 0 }, \ 275df8bae1dSRodney W. Grimes { 0, 0 }, \ 276df8bae1dSRodney W. Grimes { "pup", CTLTYPE_NODE }, \ 277df8bae1dSRodney W. Grimes { 0, 0 }, \ 278df8bae1dSRodney W. Grimes { 0, 0 }, \ 279df8bae1dSRodney W. Grimes { 0, 0 }, \ 280df8bae1dSRodney W. Grimes { 0, 0 }, \ 281df8bae1dSRodney W. Grimes { "udp", CTLTYPE_NODE }, \ 282df8bae1dSRodney W. Grimes { 0, 0 }, \ 283df8bae1dSRodney W. Grimes { 0, 0 }, \ 284df8bae1dSRodney W. Grimes { 0, 0 }, \ 285df8bae1dSRodney W. Grimes { 0, 0 }, \ 286df8bae1dSRodney W. Grimes { "idp", CTLTYPE_NODE }, \ 287df8bae1dSRodney W. Grimes } 288df8bae1dSRodney W. Grimes 289df8bae1dSRodney W. Grimes /* 290df8bae1dSRodney W. Grimes * Names for IP sysctl objects 291df8bae1dSRodney W. Grimes */ 292df8bae1dSRodney W. Grimes #define IPCTL_FORWARDING 1 /* act as router */ 293df8bae1dSRodney W. Grimes #define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ 294df8bae1dSRodney W. Grimes #define IPCTL_DEFTTL 3 /* default TTL */ 295df8bae1dSRodney W. Grimes #ifdef notyet 296df8bae1dSRodney W. Grimes #define IPCTL_DEFMTU 4 /* default MTU */ 297df8bae1dSRodney W. Grimes #endif 2985be2baf8SGarrett Wollman #define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ 299ea80aed1SGarrett Wollman #define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ 300ea80aed1SGarrett Wollman #define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ 3011025071fSGarrett Wollman #define IPCTL_SOURCEROUTE 8 /* may perform source routes */ 30242c03a52SPeter Wemm #define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */ 303054ef370SGarrett Wollman #define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */ 304054ef370SGarrett Wollman #define IPCTL_INTRQDROPS 11 /* number of netisr q drops */ 3056fce01c9SGarrett Wollman #define IPCTL_STATS 12 /* ipstat structure */ 3064fce5804SGuido van Rooij #define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */ 3074fce5804SGuido van Rooij #define IPCTL_MAXID 14 308df8bae1dSRodney W. Grimes 309df8bae1dSRodney W. Grimes #define IPCTL_NAMES { \ 310df8bae1dSRodney W. Grimes { 0, 0 }, \ 311df8bae1dSRodney W. Grimes { "forwarding", CTLTYPE_INT }, \ 312df8bae1dSRodney W. Grimes { "redirect", CTLTYPE_INT }, \ 313df8bae1dSRodney W. Grimes { "ttl", CTLTYPE_INT }, \ 314df8bae1dSRodney W. Grimes { "mtu", CTLTYPE_INT }, \ 3155be2baf8SGarrett Wollman { "rtexpire", CTLTYPE_INT }, \ 316ea80aed1SGarrett Wollman { "rtminexpire", CTLTYPE_INT }, \ 317ea80aed1SGarrett Wollman { "rtmaxcache", CTLTYPE_INT }, \ 3181025071fSGarrett Wollman { "sourceroute", CTLTYPE_INT }, \ 31942c03a52SPeter Wemm { "directed-broadcast", CTLTYPE_INT }, \ 320054ef370SGarrett Wollman { "intr-queue-maxlen", CTLTYPE_INT }, \ 321054ef370SGarrett Wollman { "intr-queue-drops", CTLTYPE_INT }, \ 3226fce01c9SGarrett Wollman { "stats", CTLTYPE_STRUCT }, \ 3234fce5804SGuido van Rooij { "accept_sourceroute", CTLTYPE_INT }, \ 324df8bae1dSRodney W. Grimes } 325df8bae1dSRodney W. Grimes 326df8bae1dSRodney W. Grimes 327df8bae1dSRodney W. Grimes #ifdef KERNEL 328ef0cdf33SGarrett Wollman struct ifnet; struct mbuf; /* forward declarations for Standard C */ 329ef0cdf33SGarrett Wollman 330df8bae1dSRodney W. Grimes int in_broadcast __P((struct in_addr, struct ifnet *)); 331df8bae1dSRodney W. Grimes int in_canforward __P((struct in_addr)); 332df8bae1dSRodney W. Grimes int in_cksum __P((struct mbuf *, int)); 333df8bae1dSRodney W. Grimes int in_localaddr __P((struct in_addr)); 334ef0cdf33SGarrett Wollman char *inet_ntoa __P((struct in_addr)); /* in libkern */ 33523bf9953SPoul-Henning Kamp 33623bf9953SPoul-Henning Kamp /* Firewall hooks */ 33723bf9953SPoul-Henning Kamp struct ip; 33823bf9953SPoul-Henning Kamp typedef int ip_fw_chk_t __P((struct ip**, int, struct ifnet*, int, struct mbuf**)); 33923bf9953SPoul-Henning Kamp typedef int ip_fw_ctl_t __P((int, struct mbuf**)); 34023bf9953SPoul-Henning Kamp extern ip_fw_chk_t *ip_fw_chk_ptr; 34123bf9953SPoul-Henning Kamp extern ip_fw_ctl_t *ip_fw_ctl_ptr; 342fed1c7e9SSøren Schmidt 343af44ef0aSAlexander Langer /* IP NAT hooks */ 3446713d4a7SSøren Schmidt typedef int ip_nat_t __P((struct ip**, struct mbuf**, struct ifnet*, int)); 345fed1c7e9SSøren Schmidt typedef int ip_nat_ctl_t __P((int, struct mbuf**)); 346fed1c7e9SSøren Schmidt extern ip_nat_t *ip_nat_ptr; 347fed1c7e9SSøren Schmidt extern ip_nat_ctl_t *ip_nat_ctl_ptr; 348fed1c7e9SSøren Schmidt #define IP_NAT_IN 0x00000001 349fed1c7e9SSøren Schmidt #define IP_NAT_OUT 0x00000002 350fed1c7e9SSøren Schmidt 35123bf9953SPoul-Henning Kamp #endif /* KERNEL */ 352707f139eSPaul Richards 353707f139eSPaul Richards #endif 354