On Mon, 2001/05/21 at 14:43:09 +0100, Ian Dowse wrote:
> In message <[EMAIL PROTECTED]>, Barney Wolff writes:
> >1. Multi-homed hosts are in fact very common, especially in
> > corporate environments. To get the right source addr in
> > its reply, the server must open separate sockets on each
> > of its host's addresses - as named and ntpd do. And then
> > it has to detect changes in the set of addresses. Hard
> > work for not a lot of gain.
>
> An alternative to this approach on the server side, which has been
> discussed before, is a mechanism to set the source address of
> individual outgoing UDP datagrams. There is already the IP_RECVDSTADDR
> socket option which can be used to determine the source address of
> the incoming packet:
>
> If the IP_RECVDSTADDR option is enabled on a SOCK_DGRAM
> socket, the recvmsg(2) call will return the destination IP
> address for a UDP datagram. The msg_control field in the
> msghdr structure points to a buffer that contains a cmsghdr
> structure followed by the IP address. The cmsghdr fields
> have the following values:
>
> cmsg_len = sizeof(struct in_addr)
> cmsg_level = IPPROTO_IP
> cmsg_type = IP_RECVDSTADDR
>
> If an IP_SENDSRCADDR control message was implemented, servers could
> use it to reply from the address to which the request was sent.
> This would not require opening additional sockets, and it would
> not need to detect interface address changes.
I have a patch that does just that (although it just overloads
IP_RECVDSTADDR for sendmsg instead of creating a new flag). I wrote it
some time ago for a DNS server (the standard requires the source
address to be the address the packet went to). It may need some
resynching, but if you want, I can dig it out and prepare it for
committing. I anyway wanted to do this some time...
- thomas
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message