From nobody@FreeBSD.org  Thu Dec 20 07:38:17 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50F3616A41A
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 Dec 2007 07:38:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 4778413C4E5
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 Dec 2007 07:38:17 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lBK7btDh062953
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 20 Dec 2007 07:37:55 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id lBK7bt2C062952;
	Thu, 20 Dec 2007 07:37:55 GMT
	(envelope-from nobody)
Message-Id: <200712200737.lBK7bt2C062952@www.freebsd.org>
Date: Thu, 20 Dec 2007 07:37:55 GMT
From: Jukka Ukkonen <jau@iki.fi>
To: freebsd-gnats-submit@FreeBSD.org
Subject: IP_RECVDSTADDR & IP_SENDSRCADDR not implemented for IPv6
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         118880
>Category:       kern
>Synopsis:       [ip6] IP_RECVDSTADDR & IP_SENDSRCADDR not implemented for IPv6
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    I
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 20 07:40:01 UTC 2007
>Closed-Date:    
>Last-Modified:  Sun May 18 05:03:48 UTC 2014
>Originator:     Jukka Ukkonen
>Release:        6.3-PRERELEASE
>Organization:
private person
>Environment:
FreeBSD mjolnir 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Sat Dec 15 16:54:29 EET 2007     root@mjolnir:/usr/obj/usr/src/sys/Mjolnir  i386
>Description:
IP_RECVDSTADDR & IP_SENDSRCADDR have not been implemented for IPv6.

When using systems with multiple IP addresses (esp. multiple alias addresses
tied to the same physical NIC) for serving UDP requests these options are
currently the only method for ensuring the source addresses for responses to
requests received via a wildcard bound socket match the addresses to which the
original requests were sent.
For IPv6 these options do not seem to work, though, for IPv4 they have been
implemented. With IPv6 one NIC practically always has multiple IPv6 addresses,
and thus the need for nailing down the correct source address for outbound
packets is needed even more than for IPv4.
With IPv6 there is no way avoiding the system randomly selecting whatever
local address as the source address based on which address happens to be the
first on a NIC's list of alias addresses when sending outbound packets unless
one binds a separate socket to each local address in advance.

Binding multiple local addresses is harmful, though, because programs do not
continuously scan the local IP addresses.

>How-To-Repeat:
Modify e.g. a simple UDP based echo program to use
setsockopt(), recvmsg(), and sendmsg() with IP_RECVDSTADDR & IP_SENDSRCADDR
instead of recvfrom() and sendto().
When using UDP/IPv4 these socket options seem to work just fine, though,
using them is somewhat too hairy for the average network programmer.
When using UDP/IPv6 these socket options are not supported.

>Fix:
In short term:
Add support for IP_RECVDSTADDR & IP_SENDSRCADDR also to IPv6.
(This is a bug fix - correcting asymmentry between IPv4 and IPv6.)

In long term:
Add support for listen() & accept() for UDP thus allowing nailing down
a particular local socket address for the new socket created by accept() and
allowing the original wildcard bound listen socket wait for packets sent to
any other local address.
(This is actually a change request.)


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Dec 20 08:10:27 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118880 

From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
To: bug-followup@FreeBSD.org, jau@iki.fi
Cc:  
Subject: Re: kern/118880: [ip6] IP_RECVDSTADDR & IP_SENDSRCADDR not implemented
 for IPv6
Date: Sat, 31 Jan 2009 13:25:20 +0000 (UTC)

 Hi,
 
 see kern/122039 which seems to be a ``duplicate'' of this one but has
 a comment for discussion.
 
 /bz
 
 -- 
 Bjoern A. Zeeb                      The greatest risk is not taking one.
State-Changed-From-To: open->closed 
State-Changed-By: vwe 
State-Changed-When: Sat Jan 31 14:23:06 UTC 2009 
State-Changed-Why:  
kern/122039 is a DUP of this PR but we're closing this in favour of 
kern/122039 as it does contain some more information. 
Thank you for your report. 


Responsible-Changed-From-To: freebsd-net->bz 
Responsible-Changed-By: vwe 
Responsible-Changed-When: Sat Jan 31 14:23:06 UTC 2009 
Responsible-Changed-Why:  
assign closed PR to bz as it seems to be of interest to him 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118880 

From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
To: bug-followup@FreeBSD.org, phk@critter.freebsd.dk
Cc:  
Subject: Re: kern/122039: IP_RECVDSTADDR not IPv6 compatible
Date: Mon, 24 Mar 2008 13:04:09 +0000 (UTC)

 Hi,
 
 Do you want to use IP_RECVDSTADDR on an AF_INET6 socket?
 
 The proper interface for an IPv6 socket is defined in RFC 3542
 [ http://www.rfc-editor.org/rfc/rfc3542.txt ].
 See Paragraph 6. Packet Information for what you are trying to achive.
 
 If you mean that it is possible to use IP_RECVDSTADDR on an IPv6
 socket that might sound bogus. I am unsure what the correct semantics
 for an v4 mapped v6 address would be but that might be a reason to
 permit this on a limited number of sockets.
 
 If we are trying to return an IPv6 address when IP_RECVDSTADDR was set
 on an IPv6 socket, that sounds like a bug and should be fixed.
 
 Unfortunately your PR is not very precise about your actual problem.
 I guess gnn knows;-)
 
 -- 
 Bjoern A. Zeeb                                 bzeeb at Zabbadoz dot NeT
 Software is harder than hardware  so better get it right the first time.

State-Changed-From-To: closed->open 
State-Changed-By: vwe 
State-Changed-When: Sat Jan 31 14:39:22 UTC 2009 
State-Changed-Why:  
have closed the wrong one - sorry 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118880 
Responsible-Changed-From-To: bz->I shall not use bugzilla 
Responsible-Changed-By: bz 
Responsible-Changed-When: Sun May 18 05:03:39 UTC 2014 
Responsible-Changed-Why:  
I shall not use bugzilla (at least until we will have a CLI). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118880 
>Unformatted:
