add pktinfo stuff
This commit is contained in:
parent
9dc2582e68
commit
0234645c61
@ -1,4 +1,4 @@
|
|||||||
.\" $NetBSD: ip.4,v 1.33 2012/06/25 14:47:55 christos Exp $
|
.\" $NetBSD: ip.4,v 1.34 2013/06/27 20:14:25 christos Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1983, 1991, 1993
|
.\" Copyright (c) 1983, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
@ -29,7 +29,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
|
.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
|
||||||
.\"
|
.\"
|
||||||
.Dd June 25, 2012
|
.Dd June 27, 2013
|
||||||
.Dt IP 4
|
.Dt IP 4
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -111,6 +111,25 @@ setsockopt(s, IPPROTO_IP, IP_IPSEC_POLICY, buf, ipsec_get_policylen(buf));
|
|||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
|
.Dv IP_PKTINFO
|
||||||
|
option can be used to turn on receiving of information about the source
|
||||||
|
address of the packet, and the interface index. The information is passed
|
||||||
|
in an
|
||||||
|
.Tp struct in_pktinfo
|
||||||
|
structure, which contains
|
||||||
|
.Bd -literal
|
||||||
|
struct in_addr ipi_addr; /* the source or destination address */
|
||||||
|
unsigned int ipi_ifindex; /* the interface index */
|
||||||
|
.Ed
|
||||||
|
and added to the control portion of the message:
|
||||||
|
The cmsghdr fields have the following values:
|
||||||
|
.Bd -literal
|
||||||
|
cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo))
|
||||||
|
cmsg_level = IPPROTO_IP
|
||||||
|
cmsg_type = IP_PKTINFO
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
The
|
||||||
.Dv IP_PORTALGO
|
.Dv IP_PORTALGO
|
||||||
can be used to randomize the port selection.
|
can be used to randomize the port selection.
|
||||||
Valid algorithms are described in
|
Valid algorithms are described in
|
||||||
@ -189,6 +208,13 @@ cmsg_level = IPPROTO_IP
|
|||||||
cmsg_type = IP_RECVIF
|
cmsg_type = IP_RECVIF
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
|
The
|
||||||
|
.Dv IP_RECVPKTINFO
|
||||||
|
option is similar to the
|
||||||
|
.Dv IP_PKTINFO
|
||||||
|
one, only in this case the inbound information is returned.
|
||||||
|
i
|
||||||
|
.Pp
|
||||||
If the
|
If the
|
||||||
.Dv IP_RECVTTL
|
.Dv IP_RECVTTL
|
||||||
option is enabled on a
|
option is enabled on a
|
||||||
|
Loading…
Reference in New Issue
Block a user