Debian Codegraph @

upstream/debian-unstable/man2/IP_OPTIONS.2const

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