Date: Mon, 04 Mar 2002 10:11:47 -0500 From: Sergey Babkin <sergey@caldera.com> To: Ian Dowse <iedowse@maths.tcd.ie> Cc: arch@freebsd.org, chawla@caldera.com, Christoph Hellwig <hch@caldera.de>, davem@redhat.com Subject: Re: proposition for new socket syscalls {send,recv}fromto Message-ID: <3C838EB3.C38E23D2@caldera.com> References: <200203020245.aa34899@salmon.maths.tcd.ie>
next in thread | previous in thread | raw e-mail | index | archive | help
Ian Dowse wrote: > > In message <3C800A80.96CEA9D2@caldera.com>, Sergey Babkin writes: > > > >The fix in short: the server should do a bind() to the right address > >before doing the reply. However in practice this code gets much more > >compilcated and ugly, as will be discussed further. > > Linux has an IP_PKTINFO socket option and IP_PKTINFO control message > that (I think) allows you record the destination IP on incoming > datagrams and set the source address on outgoing ones. A quick, > minimally tested sample program which uses it is at: > > http://www.maths.tcd.ie/~iedowse/FreeBSD/pktinfo.c It's doing essentially the same thing as I described with IP_RECVDSTADDR, I guess IP_RECVDSTADDR returns a subset of information returned by IP_PKTINFO. > In FreeBSD, we only seem to have this capability for IPv6, using > the IPV6_PKTINFO option and control messages. Implementations of > either an IP_PKTINFO or an IP_SENDSRCADDR control message have been > discussed on freebsd-net a few times, but nothing has been committed > yet. Yes, IP_SENDSRCADDR would make the sending side of things a lot easier. > For systems that have such a mechanism, the proposed syscalls could > just be implemented as library functions instead. Agreed. -SB -- Sergey Babkin sergey@caldera.com Escalations Research Group, Caldera - NJ (908)790-2385 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C838EB3.C38E23D2>