Document the IP_RECVIF socket option. Also mention that IP_RECVDSTADDR

works with SOCK_RAW sockets now, as well as SOCK_DGRAM.
This commit is contained in:
thorpej 1997-01-12 00:59:51 +00:00
parent 2773f282b9
commit a5f0d79aaa

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ip.4,v 1.3 1994/11/30 16:22:19 jtc Exp $
.\" $NetBSD: ip.4,v 1.4 1997/01/12 00:59:51 thorpej Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -114,7 +114,9 @@ setsockopt(s, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
If the
.Dv IP_RECVDSTADDR
option is enabled on a
.Dv SOCK_DGRAM
.Dv SOCK_DGRAM
or
.Dv SOCK_RAW
socket,
the
.Xr recvmsg
@ -133,6 +135,26 @@ cmsg_len = sizeof(struct in_addr)
cmsg_level = IPPROTO_IP
cmsg_type = IP_RECVDSTADDR
.Ed
.Pp
If the
.Dv IP_RECVIF
option is enabled on a
.Dv SOCK_DGRAM
or
.Dv SOCK_RAW
socket,
the
.Xr recvmsg
call will return a struct sockaddr_dl corresponding to
the interface on which the packet was received.
the msg_control field in the msghdr structure points to a buffer
that contains a cmsghdr structure followed by the struct sockaddr_dl.
The cmsghdr fields have the following values:
.Bd -literal
cmsg_len = sizeof(struct sockaddr_dl)
cmsg_level = IPPROTO_IP
cmsg_type = IP_RECVIF
.Ed
.Ss "Multicast Options"
.Pp
.Tn IP