IP_PKTINFO(2const) IP_PKTINFO(2const) NAME IP_PKTINFO - information about the incoming packet LIBRARY Standard C library (libc, -lc) SYNOPSIS #include /* Definition of IP* constants */ #include int setsockopt(int sockfd, IPPROTO_IP, IP_PKTINFO, const int *enable, sizeof(int)); DESCRIPTION Pass an IP_PKTINFO ancillary message that contains a in_pktinfo(2type) structure that supplies some information about the incoming packet. This works only for datagram oriented sockets. The argument is a flag that tells the socket whether the IP_PKTINFO message should be passed or not. The message itself can be sent/retrieved only as a control message with a packet using recvmsg(2) or sendmsg(2). Not supported for SOCK_STREAM sockets. ERRORS See IPPROTO_IP(2const). See setsockopt(2). See ip(7). VERSIONS Some BSD sockets implementations provide IP_RCVDSTADDR and IP_RECVIF socket options to get the destination address and the interface of received datagrams. Linux has the more general IP_PKTINFO for the same task. STANDARDS Linux. HISTORY Linux 2.2. SEE ALSO in_pktinfo(2const), IPPROTO_IP(2const), setsockopt(2), ip(7) Linux man-pages 6.17 2025-12-01 IP_PKTINFO(2const)