From owner-freebsd-arch Mon Mar 4 7:12:33 2002 Delivered-To: freebsd-arch@freebsd.org Received: from nimbus.nj.caldera.com (nimbus.nj.caldera.com [132.147.103.56]) by hub.freebsd.org (Postfix) with ESMTP id 33EC937B434 for ; Mon, 4 Mar 2002 07:11:54 -0800 (PST) Received: from caldera.com (bird [132.147.135.198]) by nimbus.nj.caldera.com (8.10.1/UW7.1.1-NSCd) with ESMTP id g24FBlI26694; Mon, 4 Mar 2002 10:11:48 -0500 (EST) Message-ID: <3C838EB3.C38E23D2@caldera.com> Date: Mon, 04 Mar 2002 10:11:47 -0500 From: Sergey Babkin Organization: Caldera International, Inc. X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 4.0-19990626-CURRENT i386) X-Accept-Language: ru, en MIME-Version: 1.0 To: Ian Dowse Cc: arch@freebsd.org, chawla@caldera.com, Christoph Hellwig , davem@redhat.com Subject: Re: proposition for new socket syscalls {send,recv}fromto References: <200203020245.aa34899@salmon.maths.tcd.ie> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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