From owner-freebsd-bugs@FreeBSD.ORG Thu Dec 20 07:40:01 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A953016A419 for ; Thu, 20 Dec 2007 07:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 90EF113C4D1 for ; Thu, 20 Dec 2007 07:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lBK7e1c8009082 for ; Thu, 20 Dec 2007 07:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lBK7e1GQ009081; Thu, 20 Dec 2007 07:40:01 GMT (envelope-from gnats) Resent-Date: Thu, 20 Dec 2007 07:40:01 GMT Resent-Message-Id: <200712200740.lBK7e1GQ009081@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jukka Ukkonen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50F3616A41A for ; 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 ; 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 ; 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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/118880: IP_RECVDSTADDR & IP_SENDSRCADDR not implemented for IPv6 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2007 07:40:01 -0000 >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@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: