Subject: IPv6 DAD on 1.6-stable working?
To: None <tech-net@NetBSD.org>
From: Florent Parent <Florent.Parent@hexago.com>
List: tech-net
Date: 09/28/2003 16:56:33
Is DAD (initiating) working on NetBSD 1.6 stable branch?  I wasn't able to 
make it work on my 1.6-release machine. Inspecting the code reveals:

netinet6/nd6_nbr.c
/*	$NetBSD: nd6_nbr.c,v 1.34 2002/03/15 09:36:27 itojun Exp $	*/
/*	$KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $	*/

nd6_ns_output() calls ip6_output(m, NULL, NULL, 0, &im6o, NULL);

flags argument to ip6_output is 0. This flag is used when validating the 
source address:

	/* Source address validation */
	if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src) &&
	    (flags & IPV6_DADOUTPUT) == 0) {
		error = EOPNOTSUPP;
		ip6stat.ip6s_badscope++;
		goto bad;
	}
This test fails when initiating DAD since the flag was not set correctly.

Interestingly, the KAME code does "the right thing" wrt. the flag:

(from KAME cvsweb)
netinet6/nd6_nbr.c
/*	$KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $	*/
	
ip6_output(m, NULL, NULL, dad ? IPV6_DADOUTPUT : 0, &im6o, &outif);

Am i missing something here?

Florent