From owner-freebsd-arch Fri Mar 1 18:45:11 2002 Delivered-To: freebsd-arch@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 18EBF37B402 for ; Fri, 1 Mar 2002 18:45:07 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 2 Mar 2002 02:45:06 +0000 (GMT) To: Sergey Babkin Cc: arch@freebsd.org, chawla@caldera.com Subject: Re: proposition for new socket syscalls {send,recv}fromto In-Reply-To: Your message of "Fri, 01 Mar 2002 18:10:56 EST." <3C800A80.96CEA9D2@caldera.com> Date: Sat, 02 Mar 2002 02:45:05 +0000 From: Ian Dowse Message-ID: <200203020245.aa34899@salmon.maths.tcd.ie> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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. For systems that have such a mechanism, the proposed syscalls could just be implemented as library functions instead. Ian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message