BSD 4_3_Net_2 release
[unix-history] / usr / src / share / man / man4 / ip.4
index 7ae7cf9..781b75c 100644 (file)
-.\" Copyright (c) 1983 The Regents of the University of California.
+.\" Copyright (c) 1983, 1991 The Regents of the University of California.
 .\" All rights reserved.
 .\"
 .\" All rights reserved.
 .\"
-.\" Redistribution and use in source and binary forms are permitted provided
-.\" that: (1) source distributions retain this entire copyright notice and
-.\" comment, and (2) distributions including binaries display the following
-.\" acknowledgement:  ``This product includes software developed by the
-.\" University of California, Berkeley and its contributors'' in the
-.\" documentation or other materials provided with the distribution and in
-.\" all advertising materials mentioning features or use of this software.
-.\" Neither the name of the University nor the names of its contributors may
-.\" be used to endorse or promote products derived from this software without
-.\" specific prior written permission.
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
 .\"
 .\"
-.\"    @(#)ip.4        6.4 (Berkeley) 6/23/90
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
 .\"
 .\"
-.TH IP 4 "June 23, 1990"
-.UC 5
-.SH NAME
-ip \- Internet Protocol
-.SH SYNOPSIS
-.B #include <sys/socket.h>
-.br
-.B #include <netinet/in.h>
-.PP
-.B s = socket(AF_INET, SOCK_RAW, proto);
-.SH DESCRIPTION
-IP is the transport layer protocol used
+.\"     @(#)ip.4       6.5 (Berkeley) 3/28/91
+.\"
+.Dd March 28, 1991
+.Dt IP 4
+.Os BSD 4.2
+.Sh NAME
+.Nm ip
+.Nd Internet Protocol
+.Sh SYNOPSIS
+.Fd #include <sys/socket.h>
+.Fd #include <netinet/in.h>
+.Ft int
+.Fn socket AF_INET SOCK_RAW proto
+.Sh DESCRIPTION
+.Tn IP 
+is the transport layer protocol used
 by the Internet protocol family.
 by the Internet protocol family.
-Options may be set at the IP level
-when using higher-level protocols that are based on IP
-(such as TCP and UDP).
+Options may be set at the
+.Tn IP
+level
+when using higher-level protocols that are based on
+.Tn IP
+(such as
+.Tn TCP
+and
+.Tn UDP ) .
 It may also be accessed
 It may also be accessed
-through a \*(lqraw socket\*(rq when developing new protocols, or
+through a
+.Dq raw socket
+when developing new protocols, or
 special purpose applications.
 special purpose applications.
-.PP
-A single generic option is supported at the IP level, IP_OPTIONS,
-that may be used to provide IP options to be transmitted in the IP
+.Pp
+A single generic option is supported at the
+.Tn IP
+level,
+.Dv IP_OPTIONS ,
+that may be used to provide
+.Tn IP
+options to be transmitted in the
+.Tn IP
 header of each outgoing packet.
 Options are set with
 header of each outgoing packet.
 Options are set with
-.IR setsockopt (2)
+.Xr setsockopt 2
 and examined with
 and examined with
-.IR getsockopt (2).
-The format of IP options to be sent is that specified by the IP protocol
+.Xr getsockopt 2 .
+The format of
+.Tn IP
+options to be sent is that specified by the
+.Tn IP protocol
 specification, with one exception:
 the list of addresses for Source Route options must include the first-hop
 gateway at the beginning of the list of gateways.
 The first-hop gateway address will be extracted from the option list
 and the size adjusted accordingly before use.
 specification, with one exception:
 the list of addresses for Source Route options must include the first-hop
 gateway at the beginning of the list of gateways.
 The first-hop gateway address will be extracted from the option list
 and the size adjusted accordingly before use.
-IP options may be used with any socket type in the Internet family.
-.PP
-Raw IP sockets are connectionless,
+.Tn IP
+options may be used with any socket type in the Internet family.
+.Pp
+Raw
+.Tn IP
+sockets are connectionless,
 and are normally used with the
 and are normally used with the
-.I sendto 
+.Xr sendto
 and
 and
-.I recvfrom 
+.Xr recvfrom
 calls, though the
 calls, though the
-.IR connect (2)
+.Xr connect 2
 call may also be used to fix the destination for future
 packets (in which case the 
 call may also be used to fix the destination for future
 packets (in which case the 
-.IR read (2)
+.Xr read 2
 or
 or
-.IR recv (2)
+.Xr recv 2
 and 
 and 
-.IR write (2)
+.Xr write 2
 or
 or
-.IR send (2)
+.Xr send 2
 system calls may be used).
 system calls may be used).
-.PP
+.Pp
 If
 If
-.I proto
-is 0, the default protocol IPPROTO_RAW is used for outgoing
+.Fa proto
+is 0, the default protocol
+.Dv IPPROTO_RAW
+is used for outgoing
 packets, and only incoming packets destined for that protocol
 are received.
 If
 packets, and only incoming packets destined for that protocol
 are received.
 If
-.I proto
+.Fa proto
 is non-zero, that protocol number will be used on outgoing packets
 and to filter incoming packets.
 is non-zero, that protocol number will be used on outgoing packets
 and to filter incoming packets.
-.PP
-Outgoing packets automatically have an IP header prepended to
+.Pp
+Outgoing packets automatically have an
+.Tn IP
+header prepended to
 them (based on the destination address and the protocol
 number the socket is created with).
 them (based on the destination address and the protocol
 number the socket is created with).
-Incoming packets are received with IP header and options intact.
-.SH DIAGNOSTICS
+Incoming packets are received with
+.Tn IP
+header and options intact.
+.Sh DIAGNOSTICS
 A socket operation may fail with one of the following errors returned:
 A socket operation may fail with one of the following errors returned:
-.TP 15
-[EISCONN]
+.Bl -tag -width [EADDRNOTAVAIL]
+.It Bq Er EISCONN
 when trying to establish a connection on a socket which
 already has one, or when trying to send a datagram with the destination
 address specified and the socket is already connected;
 when trying to establish a connection on a socket which
 already has one, or when trying to send a datagram with the destination
 address specified and the socket is already connected;
-.TP 15
-[ENOTCONN]
+.It Bq Er ENOTCONN
 when trying to send a datagram, but
 no destination address is specified, and the socket hasn't been
 connected;
 when trying to send a datagram, but
 no destination address is specified, and the socket hasn't been
 connected;
-.TP 15
-[ENOBUFS]
+.It Bq Er ENOBUFS
 when the system runs out of memory for
 an internal data structure;
 when the system runs out of memory for
 an internal data structure;
-.TP 15
-[EADDRNOTAVAIL]
+.It Bq Er EADDRNOTAVAIL
 when an attempt is made to create a 
 socket with a network address for which no network interface
 exists.
 when an attempt is made to create a 
 socket with a network address for which no network interface
 exists.
-.PP
-The following errors specific to IP
-may occur when setting or getting IP options:
-.TP 15
-[EINVAL]
+.El
+.Pp
+The following errors specific to
+.Tn IP
+may occur when setting or getting
+.Tn IP
+options:
+.Bl -tag -width EADDRNOTAVAILxx
+.It Bq Er EINVAL
 An unknown socket option name was given.
 An unknown socket option name was given.
-.TP 15
-[EINVAL]
+.It Bq Er EINVAL
 The IP option field was improperly formed;
 an option field was shorter than the minimum value
 or longer than the option buffer provided.
 The IP option field was improperly formed;
 an option field was shorter than the minimum value
 or longer than the option buffer provided.
-.SH SEE ALSO
-getsockopt(2), send(2), recv(2), intro(4), icmp(4), inet(4)
+.El
+.Sh SEE ALSO
+.Xr getsockopt 2 ,
+.Xr send 2 ,
+.Xr recv 2 ,
+.Xr intro 4 ,
+.Xr icmp 4 ,
+.Xr inet 4
+.Sh HISTORY
+The
+.Nm
+protocol appeared in
+.Bx 4.2 .