kern/118880: IP_RECVDSTADDR & IP_SENDSRCADDR not implemented for IPv6

Jukka Ukkonen jau at iki.fi
Wed Dec 19 23:40:01 PST 2007


>Number:         118880
>Category:       kern
>Synopsis:       IP_RECVDSTADDR & IP_SENDSRCADDR not implemented for IPv6
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>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:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list