Debian Codegraph @

upstream/debian-unstable/man2/IP_PKTINFO.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_PKTINFO 2const 2025-12-01 "Linux man-pages 6.18"
6 .SH NAME
7 IP_PKTINFO
8 \-
9 information about the incoming 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_PKTINFO,
19 .BI " const\~int\~*" enable ,\~sizeof(int));
20 .fi
21 .SH DESCRIPTION
22 Pass an
23 .B IP_PKTINFO
24 ancillary message that contains a
25 .BR in_pktinfo (2type)
26 structure that supplies some information about the incoming packet.
27 This works only for datagram oriented sockets.
28 .P
29 The argument is a flag that tells the socket whether the
30 .B IP_PKTINFO
31 message should be passed or not.
32 .P
33 The message itself can be sent/retrieved
34 only as a control message with a packet using
35 .BR recvmsg (2)
36 or
37 .BR sendmsg (2).
38 .P
39 Not supported for
40 .B SOCK_STREAM
41 sockets.
42 .SH ERRORS
43 See
44 .BR IPPROTO_IP (2const).
45 See
46 .BR setsockopt (2).
47 See
48 .BR ip (7).
49 .SH VERSIONS
50 Some BSD sockets implementations provide
51 .B IP_RCVDSTADDR
52 and
53 .B IP_RECVIF
54 socket options to get the destination address and the interface of
55 received datagrams.
56 Linux has the more general
57 .B IP_PKTINFO
58 for the same task.
59 .SH STANDARDS
60 Linux.
61 .SH HISTORY
62 Linux 2.2.
63 .\" Precisely: since Linux 2.1.68
64 .SH SEE ALSO
65 .BR in_pktinfo (2const),
66 .BR IPPROTO_IP (2const),
67 .BR setsockopt (2),
68 .BR ip (7)