From owner-freebsd-hackers Thu Nov 27 15:51:46 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA01939 for hackers-outgoing; Thu, 27 Nov 1997 15:51:46 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from anlsun.ebr.anlw.anl.gov (anlsun.ebr.anlw.anl.gov [141.221.1.2]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id PAA01931 for ; Thu, 27 Nov 1997 15:51:43 -0800 (PST) (envelope-from cmott@srv.net) Received: from darkstar.home (tc-if3-24.ida.net [208.141.171.129]) by anlsun.ebr.anlw.anl.gov (8.6.11/8.6.11) with SMTP id QAA10057; Thu, 27 Nov 1997 16:51:33 -0700 Date: Thu, 27 Nov 1997 16:50:55 -0700 (MST) From: Charles Mott X-Sender: cmott@darkstar.home To: Luigi Rizzo cc: hackers@FreeBSD.ORG Subject: Re: a networking question... In-Reply-To: <199711272216.XAA09193@labinfo.iet.unipi.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Thu, 27 Nov 1997, Luigi Rizzo wrote: > I have the following problem with UDP: > > if I receive a packet with recvmsg, the identity of the sender is > returned in a sockaddr structure. However, I have no idea of the > destination address this packet was sent to. > > On a multihomed machine, this might be a problem even with unicast; > on a single-homed machine, this is a problem with multicast. > > Is there any way to be returned the destination address as well ? > > Cheers > Luigi I had a similar question which was kindly answered by a person named Alex (bag@sinbin.demos.su). He suggested that I use the recvmsg() call, and IP_RECVDSTADDR option enabled (man 4 ip). Another approach is to open a distinct socket for each address you are listening on and then using select() and FD_ISSET to see which socket and therefore which address the packet arrived at. Charles Mott