Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2001 18:56:02 +0100
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Thomas Moestl <tmoestl@gmx.net>
Cc:        Ian Dowse <iedowse@maths.tcd.ie>, Barney Wolff <barney@databus.com>, freebsd-net@FreeBSD.ORG
Subject:   Re: Using connect() on UDP RPC client sockets. 
Message-ID:   <200105211856.aa41143@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Mon, 21 May 2001 17:24:19 %2B0200." <20010521172419.A672@crow.dom2ip.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20010521172419.A672@crow.dom2ip.de>, Thomas Moestl writes:
>
>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...

Thanks! I know I had seen this somewhere - turns out I had saved
it in my freebsd-net mailbox too. Getting this functionality
committed would be a great first step towards resolving the wrong-
address issue at least between FreeBSD hosts.

I think the option should be renamed to something like IP_SENDSRCADDR
just to avoid confusion - does this seem reasonable? I'll read
through the patch shortly and maybe see if it still applies.

Actually, a bit more searching has shown up some more posibilities.
IPv6 uses a IPV6_PKTINFO option, based on the in6_pktinfo struct:

struct in6_pktinfo {
	struct in6_addr	ipi6_addr;	/* src/dst IPv6 address */
	unsigned int	ipi6_ifindex;	/* send/recv interface index */
};

and it seems Linux has something similar for IPv4 which uses an
IP_PKTINFO option:

struct in_pktinfo
{
    unsigned int ipi_ifindex;   /* Interface index */
    struct in_addr  ipi_spec_dst;/* Routing destination address */
    struct in_addr  ipi_addr;   /* Header Destination address */
};

I think the idea of both is that you can specify the source address
and interface of outgoing packets, and get the destination address
and receive interface of incoming packets. I suppose the ipi_spec_dst
in the Linux in_pktinfo is to use a different destination address
for the routing table lookup; I'm not sure why you'd want to do
that though.

Would that seem a better interface to implement?

Ian

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200105211856.aa41143>