1273482Sngie/* $FreeBSD: releng/10.3/lib/libnetbsd/netinet/in.h 273482 2014-10-22 21:04:54Z ngie $ */
2273482Sngie
3273482Sngie/*
4273482Sngie * Copyright (c) 1982, 1986, 1990, 1993
5273482Sngie *	The Regents of the University of California.  All rights reserved.
6273482Sngie *
7273482Sngie * Redistribution and use in source and binary forms, with or without
8273482Sngie * modification, are permitted provided that the following conditions
9273482Sngie * are met:
10273482Sngie * 1. Redistributions of source code must retain the above copyright
11273482Sngie *    notice, this list of conditions and the following disclaimer.
12273482Sngie * 2. Redistributions in binary form must reproduce the above copyright
13273482Sngie *    notice, this list of conditions and the following disclaimer in the
14273482Sngie *    documentation and/or other materials provided with the distribution.
15273482Sngie * 3. Neither the name of the University nor the names of its contributors
16273482Sngie *    may be used to endorse or promote products derived from this software
17273482Sngie *    without specific prior written permission.
18273482Sngie *
19273482Sngie * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20273482Sngie * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21273482Sngie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22273482Sngie * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23273482Sngie * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24273482Sngie * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25273482Sngie * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26273482Sngie * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27273482Sngie * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28273482Sngie * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29273482Sngie * SUCH DAMAGE.
30273482Sngie *
31273482Sngie *	@(#)in.h	8.3 (Berkeley) 1/3/94
32273482Sngie */
33273482Sngie
34273482Sngie#ifndef _LIBNETBSD_NETINET_IN_H_
35273482Sngie#define _LIBNETBSD_NETINET_IN_H_
36273482Sngie
37273482Sngie#include_next <netinet/in.h>
38273482Sngie
39273482Sngie/*
40273482Sngie * Local port number conventions:
41273482Sngie *
42273482Sngie * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
43273482Sngie * unless a kernel is compiled with IPNOPRIVPORTS defined.
44273482Sngie *
45273482Sngie * When a user does a bind(2) or connect(2) with a port number of zero,
46273482Sngie * a non-conflicting local port address is chosen.
47273482Sngie *
48273482Sngie * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
49273482Sngie * that is settable by sysctl(3); net.inet.ip.anonportmin and
50273482Sngie * net.inet.ip.anonportmax respectively.
51273482Sngie *
52273482Sngie * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
53273482Sngie * default assignment range.
54273482Sngie *
55273482Sngie * The value IP_PORTRANGE_DEFAULT causes the default behavior.
56273482Sngie *
57273482Sngie * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
58273482Sngie * and exists only for FreeBSD compatibility purposes.
59273482Sngie *
60273482Sngie * The value IP_PORTRANGE_LOW changes the range to the "low" are
61273482Sngie * that is (by convention) restricted to privileged processes.
62273482Sngie * This convention is based on "vouchsafe" principles only.
63273482Sngie * It is only secure if you trust the remote host to restrict these ports.
64273482Sngie * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
65273482Sngie */
66273482Sngie
67273482Sngie#define	IPPORT_ANONMIN		49152
68273482Sngie#define	IPPORT_ANONMAX		65535
69273482Sngie#define	IPPORT_RESERVEDMIN	600
70273482Sngie#define	IPPORT_RESERVEDMAX	(IPPORT_RESERVED-1)
71273482Sngie
72273482Sngie#endif
73