aboutsummaryrefslogtreecommitdiff
path: root/share/man/man4/ip.4
diff options
context:
space:
mode:
authorIan Dowse <iedowse@FreeBSD.org>2002-10-21 20:40:02 +0000
committerIan Dowse <iedowse@FreeBSD.org>2002-10-21 20:40:02 +0000
commitc557ae16ce36e843cefe7287b6a0b9f3b6d94aa0 (patch)
treef73628bb4740abef23fe9db016ee5002de0220f7 /share/man/man4/ip.4
parent06f0dd00a0572df0f2ecfeb7800865672f9eb979 (diff)
downloadsrc-c557ae16ce36e843cefe7287b6a0b9f3b6d94aa0.tar.gz
src-c557ae16ce36e843cefe7287b6a0b9f3b6d94aa0.zip
Implement a new IP_SENDSRCADDR ancillary message type that permits
a server process bound to a wildcard UDP socket to select the IP address from which outgoing packets are sent on a per-datagram basis. When combined with IP_RECVDSTADDR, such a server process can guarantee to reply to an incoming request using the same source IP address as the destination IP address of the request, without having to open one socket per server IP address. Discussed on: -net Approved by: re
Notes
Notes: svn path=/head/; revision=105651
Diffstat (limited to 'share/man/man4/ip.4')
-rw-r--r--share/man/man4/ip.428
1 files changed, 28 insertions, 0 deletions
diff --git a/share/man/man4/ip.4 b/share/man/man4/ip.4
index 69b0f2a525ef..cae70613bf90 100644
--- a/share/man/man4/ip.4
+++ b/share/man/man4/ip.4
@@ -136,6 +136,34 @@ cmsg_level = IPPROTO_IP
cmsg_type = IP_RECVDSTADDR
.Ed
.Pp
+The source address to be used for outgoing
+.Tn UDP
+datagrams on a socket that is not bound to a specific
+.Tn IP
+address can be specified as ancillary data with a type code of
+.Dv IP_SENDSRCADDR .
+The msg_control field in the msghdr structure should point to a buffer
+that contains a cmsghdr structure followed by the
+.Tn IP
+address.
+The cmsghdr fields should have the following values:
+.Bd -literal
+cmsg_len = sizeof(struct in_addr)
+cmsg_level = IPPROTO_IP
+cmsg_type = IP_SENDSRCADDR
+.Ed
+.Pp
+For convenience,
+.Dv IP_SENDSRCADDR
+is defined to have the same value as
+.Dv IP_RECVDSTADDR ,
+so the
+.Dv IP_RECVDSTADDR
+control message from
+.Xr recvmsg 2
+can be used directly as a control message for
+.Xr sendmsg 2 .
+.Pp
.Dv IP_PORTRANGE
may be used to set the port range used for selecting a local port number
on a socket with an unspecified (zero) port number.