X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/9bccf70c0258c7cac2dcb80011b2a964d884c552..0a7de7458d150b5d4dffc935ba399be265ef0a1a:/bsd/man/man4/ip.4?ds=sidebyside diff --git a/bsd/man/man4/ip.4 b/bsd/man/man4/ip.4 index c351178e1..c5cc79b90 100644 --- a/bsd/man/man4/ip.4 +++ b/bsd/man/man4/ip.4 @@ -129,10 +129,29 @@ that contains a cmsghdr structure followed by the address. The cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(struct in_addr) +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVDSTADDR .Ed +.Pp +If the +.Dv IP_RECVTOS +option is enabled on a +.Dv SOCK_DGRAM +or +.Dv SOCK_RAW +socket, +the +.Xr recvmsg +call will return the TOS (type of service) field of the IP header. +The msg_control field in the msghdr structure points to a buffer +that contains a cmsghdr structure followed by the TOS. +The cmsghdr fields have the following values: +.Bd -literal +cmsg_len = CMSG_LEN(sizeof(u_char)) +cmsg_level = IPPROTO_IP +cmsg_type = IP_RECVTOS +.Ed .Ss "Multicast Options" .Pp .Tn IP @@ -324,13 +343,14 @@ the fields of the IP header, including the following: ip->ip_v = IPVERSION; ip->ip_hl = hlen >> 2; ip->ip_id = 0; /* 0 means kernel set appropriate value */ -ip->ip_off = htons(offset); -ip->ip_len = htons(len); +ip->ip_off = offset; +ip->ip_len = len; .Ed .sp .5 -Additionally note that starting with -.Tn OpenBSD 2.1 -the ip_off and ip_len fields are in network byte order. +.Pp +Note that +the ip_off and ip_len fields are in host byte order. +.Pp If the header source address is set to .Dv INADDR_ANY, the kernel will choose an appropriate address. @@ -372,11 +392,11 @@ or longer than the option buffer provided. .El .Sh SEE ALSO .Xr getsockopt 2 , -.Xr send 2 , .Xr recv 2 , -.Xr intro 4 , +.Xr send 2 , .Xr icmp 4 , -.Xr inet 4 +.Xr inet 4 , +.Xr intro 4 .Sh HISTORY The .Nm