Re: ip6(4) manpage update

2012-06-18 Thread Jason McIntyre
On Sun, Jun 17, 2012 at 01:09:49PM +0200, Peter J. Philipp wrote:
 
 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 -   1.25
 +++ ip6.4 17 Jun 2012 10:45:19 -
 @@ -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 intipi6_ifindex; /* send/recv if index */
  };
  .Ed
 -.It Dv IPV6_HOPLIMIT Fa int *
 +

the blank line above should be a .Pp.

also this diff adds trailing whitespace at eol in a few places. please
remove it.

except for that, i'm fine with this diff, if some developer wants to
take it.

jmc

 +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 

Re: ip6(4) manpage update

2012-06-18 Thread Peter J. Philipp
On Mon, Jun 18, 2012 at 08:06:06AM +0100, Jason McIntyre wrote:
 the blank line above should be a .Pp.
 
 also this diff adds trailing whitespace at eol in a few places. please
 remove it.
 
 except for that, i'm fine with this diff, if some developer wants to
 take it.
 
 jmc

Awesome!  Well here is my attempt three then.


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 -   1.25
+++ ip6.4   18 Jun 2012 08:06:35 -
@@ -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,7 +250,10 @@
unsigned intipi6_ifindex; /* send/recv if index */
 };
 .Ed
-.It Dv IPV6_HOPLIMIT Fa int *
+.Pp
+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
@@ -258,6 +261,8 @@
 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
@@ -289,7 +294,9 @@
 routine and family of routines may be used to manipulate this data.
 .Pp
 This option requires superuser privileges.
-.It Dv IPV6_DSTOPTS Fa int *
+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.



Re: ip6(4) manpage update

2012-06-18 Thread Jason McIntyre
On Mon, Jun 18, 2012 at 10:09:40AM +0200, Peter J. Philipp wrote:
 On Mon, Jun 18, 2012 at 08:06:06AM +0100, Jason McIntyre wrote:
  the blank line above should be a .Pp.
  
  also this diff adds trailing whitespace at eol in a few places. please
  remove it.
  
  except for that, i'm fine with this diff, if some developer wants to
  take it.
  
  jmc
 
 Awesome!  Well here is my attempt three then.
 
 

looks fine to me now.
jmc

 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 -   1.25
 +++ ip6.4 18 Jun 2012 08:06:35 -
 @@ -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,7 +250,10 @@
   unsigned intipi6_ifindex; /* send/recv if index */
  };
  .Ed
 -.It Dv IPV6_HOPLIMIT Fa int *
 +.Pp
 +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
 @@ -258,6 +261,8 @@
  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
 @@ -289,7 +294,9 @@
  routine and family of routines may be used to manipulate this data.
  .Pp
  This option requires superuser privileges.
 -.It Dv IPV6_DSTOPTS Fa int *
 +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 

Re: [PATCH] uvideo(4): fix kernel crash when enumerating non-existant formats

2012-06-18 Thread Martin Pieuchot
On 16/06/12(Sat) 21:16, Gregor Best wrote:
 Hi people,
 
 the attached patch fixes a little bug in uvideo(4), where using 
 VIDIOC_ENUM_FMT
 with fmtdesc-index strictly larger than the number of available video formats
 crashes the kernel (I forgot the exact error message, but a crash is a crash 
 and
 the attached patch fixes it).

Thanks. Out of curiosity with which application did you find this? 

 
 -- 
 Gregor Best
 Index: dev/usb/uvideo.c
 ===
 RCS file: /cvs/src/sys/dev/usb/uvideo.c,v
 retrieving revision 1.166
 diff -u -p -r1.166 uvideo.c
 --- dev/usb/uvideo.c  28 Oct 2011 12:48:31 -  1.166
 +++ dev/usb/uvideo.c  16 Jun 2012 19:15:58 -
 @@ -2775,7 +2775,7 @@ uvideo_enum_fmt(void *v, struct v4l2_fmt
   /* type not supported */
   return (EINVAL);
  
 - if (fmtdesc-index == sc-sc_fmtgrp_num) 
 + if (fmtdesc-index = sc-sc_fmtgrp_num)
   /* no more formats left */
   return (EINVAL);
   idx = fmtdesc-index;