On Sun, Jun 17, 2012 at 12:49:08PM +0200, Peter J. Philipp wrote:
> On Sat, Jun 16, 2012 at 07:17:16PM -0700, Philip Guenther wrote:
> > > You can expect the same issue with IPV6_PKTINFO, IPV6_HOPOPTS,
> > > IPV6_DSTOPTS,
> > > and IPV6_RTHDR. The "RECV" part was added to them in RFC3542.
> >
> > Yep. In addition, the text should be clarified to indicate that
> > turning on IPV6_RECV* will result in the process getting cmsg data of
> > type IPV6_*. E.g., IPV6_RECVHOPLIMIT turns on receiving of
> > IPV6_HOPLIMIT cmsg data.
> >
> > Peter, do you want to take a stab at that part too?
> >
> >
> > (There's also a typo in the current page: s/HOPTLIMIT/HOPLIMIT/)
> >
> >
> > Philip Guenther
>
> Sure I'll take a stab at it but its very difficult I found (I was also
> distracted by freeing a bird from the attic). Here goes:
attempt two.. process was the wrong word, I substituted it with socket.
-peter
Index: ip6.4
===================================================================
RCS file: /cvs/src/share/man/man4/ip6.4,v
retrieving revision 1.25
diff -u -r1.25 ip6.4
--- ip6.4 8 Sep 2011 16:43:56 -0000 1.25
+++ ip6.4 17 Jun 2012 10:45:19 -0000
@@ -237,7 +237,7 @@
.It Dv IPV6_PORTRANGE_LOW
Use a low, reserved range (600\-1023).
.El
-.It Dv IPV6_PKTINFO Fa "int *"
+.It Dv IPV6_RECVPKTINFO Fa "int *"
Get or set whether additional information about subsequent packets will
be provided as ancillary data along with the payload in subsequent
.Xr recvmsg 2
@@ -250,14 +250,19 @@
unsigned int ipi6_ifindex; /* send/recv if index */
};
.Ed
-.It Dv IPV6_HOPLIMIT Fa "int *"
+
+Turning this option on will result in this socket getting cmsg data of
+type IPV6_PKTINFO.
+.It Dv IPV6_RECVHOPLIMIT Fa "int *"
Get or set whether the hop limit header field from subsequent packets
will be provided as ancillary data along with the payload in subsequent
.Xr recvmsg 2
-calls.
+calls.
The value is stored as an
.Vt int
in the ancillary data returned.
+Turning this option on will result in this socket getting cmsg data of
+type IPV6_HOPLIMIT.
.\" .It Dv IPV6_NEXTHOP Fa "int *"
.\" Get or set whether the address of the next hop for subsequent
.\" packets will be provided as ancillary data along with the payload in
@@ -269,7 +274,7 @@
.\" structure in the ancillary data returned.
.\" .Pp
.\" This option requires superuser privileges.
-.It Dv IPV6_HOPOPTS Fa "int *"
+.It Dv IPV6_RECVHOPOPTS Fa "int *"
Get or set whether the hop-by-hop options from subsequent packets will be
provided as ancillary data along with the payload in subsequent
.Xr recvmsg 2
@@ -288,8 +293,10 @@
.Fn inet6_option_space
routine and family of routines may be used to manipulate this data.
.Pp
-This option requires superuser privileges.
-.It Dv IPV6_DSTOPTS Fa "int *"
+This option requires superuser privileges.
+Turning this option on will result in this socket getting cmsg data of
+type IPV6_HOPOPTS.
+.It Dv IPV6_RECVDSTOPTS Fa "int *"
Get or set whether the destination options from subsequent packets will
be provided as ancillary data along with the payload in subsequent
.Xr recvmsg 2
@@ -309,6 +316,8 @@
routine and family of routines may be used to manipulate this data.
.Pp
This option requires superuser privileges.
+Turning this option on will result in this socket getting cmsg data of
+type IPV6_DSTOPTS.
.It Dv IPV6_TCLASS Fa "int *"
Get or set the value of the traffic class field used for outgoing datagrams
on this socket.
@@ -321,7 +330,7 @@
calls.
The header field is stored as a single value of type
.Vt int .
-.It Dv IPV6_RTHDR Fa "int *"
+.It Dv IPV6_RECVRTHDR Fa "int *"
Get or set whether the routing header from subsequent packets will be
provided as ancillary data along with the payload in subsequent
.Xr recvmsg 2
@@ -343,6 +352,8 @@
routine and family of routines may be used to manipulate this data.
.Pp
This option requires superuser privileges.
+Turning this option on will result in this socket getting cmsg data of
+type IPV6_RTHDR.
.It Dv IPV6_PKTOPTIONS Fa "struct cmsghdr *"
Get or set all header options and extension headers at one time on the
last packet sent or received on the socket.
@@ -413,11 +424,11 @@
.El
.Pp
The
-.Dv IPV6_PKTINFO ,
-.\" .Dv IPV6_NEXTHOP ,
-.Dv IPV6_HOPLIMIT ,
-.Dv IPV6_HOPOPTS ,
-.Dv IPV6_DSTOPTS ,
+.Dv IPV6_RECVPKTINFO ,
+.\" .Dv IPV6_RECVNEXTHOP ,
+.Dv IPV6_RECVHOPLIMIT ,
+.Dv IPV6_RECVHOPOPTS ,
+.Dv IPV6_RECVDSTOPTS ,
and
.Dv IPV6_RTHDR
options will return ancillary data along with payload contents in subsequent
@@ -429,7 +440,7 @@
and
.Va cmsg_type
set to respective option name value (e.g.,
-.Dv IPV6_HOPTLIMIT ) .
+.Dv IPV6_HOPLIMIT ) .
These options may also be used directly as ancillary
.Va cmsg_type
values in
@@ -455,7 +466,7 @@
can be set by the
.Dv IPV6_MULTICAST_IF
socket option, through the
-.Dv IPV6_PKTINFO
+.Dv IPV6_RECVPKTINFO
option, and through the
.Va sin6_scope_id
field of the socket address passed to the
@@ -590,7 +601,7 @@
* returned along with the payload.
*/
optval = 1;
-if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
+if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &optval,
sizeof(optval)) == -1)
err(1, "setsockopt");
@@ -685,6 +696,15 @@
.%A B. Fenner
.%A A. Rudoff
.%T UNIX Network Programming, third edition
+.Re
+.Rs
+.%A W. Stevens
+.%A M. Thomas
+.%A E. Nordmark
+.%A T. Jinmei
+.%T Advanced Sockets Application Program Interface (API) for IPv6
+.%R RFC 3542
+.%D May 2003
.Re
.Sh STANDARDS
Most of the socket options are defined in RFC 2292 or RFC 2553.