diff options
author | Vincent Gross <vgross@cvs.openbsd.org> | 2016-08-16 22:21:18 +0000 |
---|---|---|
committer | Vincent Gross <vgross@cvs.openbsd.org> | 2016-08-16 22:21:18 +0000 |
commit | 0f729c97b3da0f305676c911cadffc6bae47a53c (patch) | |
tree | b3a9e8e5f9f5a3fc0087d634c6a0458a3b990370 /share/man | |
parent | 2c9970a56e902c79df924b484deecb11013aa6d5 (diff) |
Add IP_SENDSRCADDR cmsg for UDP sockets. As suggested by sthen@,
IP_SENDSRCADDR == IP_RECVDSTADDR.
OK sthen@ jca@ bluhm@
Diffstat (limited to 'share/man')
-rw-r--r-- | share/man/man4/ip.4 | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4 index b8daeb47ed8..85f3728064e 100644 --- a/share/man/man4/ip.4 +++ b/share/man/man4/ip.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ip.4,v 1.39 2016/06/28 17:32:58 jca Exp $ +.\" $OpenBSD: ip.4,v 1.40 2016/08/16 22:21:17 vgross Exp $ .\" $NetBSD: ip.4,v 1.3 1994/11/30 16:22:19 jtc Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" -.Dd $Mdocdate: June 28 2016 $ +.Dd $Mdocdate: August 16 2016 $ .Dt IP 4 .Os .Sh NAME @@ -289,6 +289,34 @@ cmsg_len = CMSG_LEN(sizeof(u_int)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVRTABLE .Ed +.Pp +When sending on a +.Dv SOCK_DGRAM +socket with +.Xr sendmsg 2 +, the source address to be used can be passed as ancillary data with a type code of +.Dv IP_SENDSRCADDR . +The +.Va msg_control +field in the +.Vt msghdr +structure should point to a buffer that contains a +.Vt cmsghdr +structure followed by the requested source address. +The +.Vt cmsghdr +fields should have the following values: +.Bd -literal -offset indent +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) +cmsg_level = IPPROTO_IP +cmsg_type = IP_SENDSRCADDR +.Ed +.Pp +The same checks and restrictions as for +.Xr bind 2 +apply, unless the socket is bound to +.Dv INADDR_ANY . +In this case, there is no source address overlap check. .Ss "Multicast Options" .Tn IP multicasting is supported only on |