aboutsummaryrefslogtreecommitdiffstats
path: root/man/man2const/IP_OPTIONS.2const
blob: f60d5aece08b36bc042fcb345457f3590c65e491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.\" Copyright, the authors of the Linux man-pages project
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH IP_OPTIONS 2const (date) "Linux man-pages (unreleased)"
.SH NAME
IP_OPTIONS
\-
options to be sent with every packet
.SH LIBRARY
Standard C library
.RI ( libc ,\~ \-lc )
.SH SYNOPSIS
.nf
.BR "#include <netinet/in.h>" "  /* Definition of " IP* " constants */"
.B #include <sys/socket.h>
.P
.BI int\~setsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_OPTIONS,
.BI "               const\~void\~" buf [ size ],\~size_t\~ size );
.BI int\~getsockopt(int\~ sockfd ,\~IPPROTO_IP,\~IP_OPTIONS,
.BI "               void\~" buf [ size ],\~size_t\~ size );
.fi
.SH DESCRIPTION
Set or get the IP options to be sent with every packet from this socket.
.P
The arguments are a pointer to a memory buffer containing the options
and the buffer length.
.P
The
.BR setsockopt (2)
call sets the IP options associated with a socket.
The maximum option size for IPv4 is 40 bytes.
See RFC\ 791 for the allowed options.
.P
When the initial connection request packet for a
.B SOCK_STREAM
socket contains IP options,
the IP options will be set automatically
to the options from the initial packet with routing headers reversed.
.P
Incoming packets are not allowed to change options
after the connection is established.
.P
The processing of all incoming source routing options
is disabled by default and can be enabled by using the
.I accept_source_route
.I /proc
interface.
Other options like timestamps are still handled.
.P
For datagram sockets, IP options can be set only by the local user.
.P
Calling
.BR getsockopt (2)
with
.B IP_OPTIONS
puts the current IP options used for sending into the supplied buffer.
.SH ERRORS
See
.BR IPPROTO_IP (2const).
See
.BR setsockopt (2).
See
.BR ip (7).
.SH HISTORY
Linux 2.0.
.\" Precisely: since Linux 1.3.30
.SH SEE ALSO
.BR IPPROTO_IP (2const),
.BR setsockopt (2),
.BR ip (7)