NetBSD Problem Report #47433

From campbell@mumble.net  Fri Jan 11 18:19:18 2013
Return-Path: <campbell@mumble.net>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id C289863C07C
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 11 Jan 2013 18:19:18 +0000 (UTC)
Message-Id: <20130111181900.CA771604B9@jupiter.mumble.net>
Date: Fri, 11 Jan 2013 18:19:00 +0000 (UTC)
From: Taylor R Campbell <campbell+netbsd@mumble.net>
Reply-To: Taylor R Campbell <campbell+netbsd@mumble.net>
To: gnats-bugs@gnats.NetBSD.org
Subject: dhcpcd gets confused by two interfaces on the same LAN with IPv6 RAs
X-Send-Pr-Version: 3.95

>Number:         47433
>Category:       bin
>Synopsis:       dhcpcd gets confused by two interfaces on the same LAN with IPv6 RAs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 11 18:20:00 +0000 2013
>Closed-Date:    Mon Jan 28 20:37:04 +0000 2013
>Last-Modified:  Mon Jan 28 20:37:04 +0000 2013
>Originator:     Taylor R Campbell <campbell+netbsd@mumble.net>
>Release:        NetBSD 6.0_STABLE
>Organization:
>Environment:
System: NetBSD ... 6.0_STABLE NetBSD 6.0_STABLE (RIAKERN) #0: Tue Jan 8 06:19:52 UTC 2013 root@...:/home/riastradh/netbsd/current/obj/sys/arch/amd64/compile/RIAMONOHACK amd64
Architecture: amd64
Machine: amd64
>Description:

	If you have two interfaces, say wm0 and wpi0, on the same LAN,
	and there is an IPv6 router sending router advertisements, then
	dhcpcd will assign both interfaces the same IPv6 address based
	on the MAC address of one of the interfaces.

# dhcpcd -B -d
...
dhcpcd[25745]: wm0: using hwaddr 00:ef:59:40:cb:49
...
dhcpcd[25745]: wm0: Sending IPv6 Router Solicitation
...
dhcpcd[25745]: wpi0: using hwaddr 00:20:96:9c:e9:c7
...
dhcpcd[25745]: wpi0: Sending IPv6 Router Solicitation
...
dhcpcd[25745]: wm0: Router Advertisement from fe80::298:84ff:fe2f:5f96
dhcpcd[25745]: wm0: adding address 2001:2785:b593:587f:220:96ff:fe9c:e9c7/64
...
dhcpcd[25745]: wpi0: Router Advertisement from fe80::298:84ff:fe2f:5f96
dhcpcd[25745]: wpi0: adding address 2001:2785:b593:587f:220:96ff:fe9c:e9c7/64
...

	(Addresses randomized to protect the innocent.)

	The problem is in both netbsd-6 and HEAD as of a few days ago.

>How-To-Repeat:

	Connect two interfaces to a common LAN with an IPv6 router.
	Run dhcpcd.  See one address on two different interfaces in
	`ifconfig -a' output.

>Fix:

	I believe the source of the problem is that ipv6rs_handledata
	in ipv6rs.c avoids allocating a new struct ra if it has already
	seen a router advertisement from the same source address, so it
	chooses an IPv6 address based on the MAC address of the
	interface that the first RA for that prefix came in on.
	Instead, ipv6rs_handledata should probably allocate a new
	struct ra if the packet came in on a different interface.

>Release-Note:

>Audit-Trail:
From: Taylor R Campbell <campbell+netbsd@mumble.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/47433: dhcpcd gets confused by two interfaces on the same LAN with IPv6 RAs
Date: Fri, 11 Jan 2013 20:11:19 +0000

 The following patch seems to fix the problem.

 Index: external/bsd/dhcpcd/dist/ipv6rs.c
 ===================================================================
 RCS file: /cvsroot/src/external/bsd/dhcpcd/dist/ipv6rs.c,v
 retrieving revision 1.1.1.9
 diff -p -u -r1.1.1.9 ipv6rs.c
 --- external/bsd/dhcpcd/dist/ipv6rs.c	6 Dec 2012 11:11:36 -0000	1.1.1.9
 +++ external/bsd/dhcpcd/dist/ipv6rs.c	11 Jan 2013 18:59:14 -0000
 @@ -462,7 +462,8 @@ ipv6rs_handledata(_unused void *arg)
  		return;
  	}
  	TAILQ_FOREACH(rap, &ipv6_routers, next) {
 -		if (memcmp(rap->from.s6_addr, from.sin6_addr.s6_addr,
 +		if (rap->iface == ifp &&
 +		    memcmp(rap->from.s6_addr, from.sin6_addr.s6_addr,
  		    sizeof(rap->from.s6_addr)) == 0)
  			break;
  	}

From: Taylor R Campbell <campbell+netbsd@mumble.net>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/47433: dhcpcd gets confused by two interfaces on the same LAN with IPv6 RAs
Date: Fri, 11 Jan 2013 21:07:59 +0000

 The same patch applies (cleanly though offset by a few lines) to
 netbsd-6, and works there too.

From: "Roy Marples" <roy@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47433 CVS commit: src/external/bsd/dhcpcd/dist
Date: Mon, 28 Jan 2013 15:45:13 +0000

 Module Name:	src
 Committed By:	roy
 Date:		Mon Jan 28 15:45:13 UTC 2013

 Update of /cvsroot/src/external/bsd/dhcpcd/dist
 In directory ivanova.netbsd.org:/tmp/cvs-serv5450

 Log Message:
 Import dhcpcd-5.6.7 with the following changes:
 * Preserve space in static routes on the command line.
 * Check correct interface the RAP came from; fixes PR bin/47433 thanks to
   Taylor R Campbell
 * Ensure the nooption works for IPv4 routes

 Status:

 Vendor Tag:	roy
 Release Tags:	dhcpcd-5-6-7

 U src/external/bsd/dhcpcd/dist/arp.c
 U src/external/bsd/dhcpcd/dist/bind.c
 U src/external/bsd/dhcpcd/dist/common.c
 U src/external/bsd/dhcpcd/dist/control.c
 C src/external/bsd/dhcpcd/dist/dhcp.c
 U src/external/bsd/dhcpcd/dist/dhcpcd.c
 U src/external/bsd/dhcpcd/dist/duid.c
 U src/external/bsd/dhcpcd/dist/eloop.c
 U src/external/bsd/dhcpcd/dist/configure.c
 U src/external/bsd/dhcpcd/dist/if-options.c
 U src/external/bsd/dhcpcd/dist/if-pref.c
 U src/external/bsd/dhcpcd/dist/ipv4ll.c
 U src/external/bsd/dhcpcd/dist/net.c
 U src/external/bsd/dhcpcd/dist/signals.c
 U src/external/bsd/dhcpcd/dist/ipv6.c
 U src/external/bsd/dhcpcd/dist/ipv6rs.c
 U src/external/bsd/dhcpcd/dist/ipv6ns.c
 U src/external/bsd/dhcpcd/dist/bpf.c
 U src/external/bsd/dhcpcd/dist/if-bsd.c
 U src/external/bsd/dhcpcd/dist/platform-bsd.c
 U src/external/bsd/dhcpcd/dist/dhcpcd.conf
 U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.8.in
 U src/external/bsd/dhcpcd/dist/dhcpcd-run-hooks.in
 U src/external/bsd/dhcpcd/dist/dhcpcd.8.in
 U src/external/bsd/dhcpcd/dist/dhcpcd.conf.5.in
 U src/external/bsd/dhcpcd/dist/arp.h
 U src/external/bsd/dhcpcd/dist/bind.h
 U src/external/bsd/dhcpcd/dist/bpf-filter.h
 U src/external/bsd/dhcpcd/dist/common.h
 U src/external/bsd/dhcpcd/dist/config.h
 U src/external/bsd/dhcpcd/dist/configure.h
 U src/external/bsd/dhcpcd/dist/control.h
 U src/external/bsd/dhcpcd/dist/defs.h
 U src/external/bsd/dhcpcd/dist/dhcp.h
 U src/external/bsd/dhcpcd/dist/dhcpcd.h
 U src/external/bsd/dhcpcd/dist/duid.h
 U src/external/bsd/dhcpcd/dist/eloop.h
 U src/external/bsd/dhcpcd/dist/if-options.h
 U src/external/bsd/dhcpcd/dist/if-pref.h
 U src/external/bsd/dhcpcd/dist/ipv4ll.h
 U src/external/bsd/dhcpcd/dist/ipv6.h
 U src/external/bsd/dhcpcd/dist/ipv6ns.h
 U src/external/bsd/dhcpcd/dist/ipv6rs.h
 U src/external/bsd/dhcpcd/dist/net.h
 U src/external/bsd/dhcpcd/dist/platform.h
 U src/external/bsd/dhcpcd/dist/signals.h
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/01-test
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/02-dump
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/10-mtu
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/29-lookup-hostname
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/30-hostname
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf
 U src/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ypbind

 1 conflicts created by this import.
 Use the following command to help the merge:

 	cvs checkout -jroy:yesterday -jroy src/external/bsd/dhcpcd/dist

State-Changed-From-To: open->closed
State-Changed-By: roy@NetBSD.org
State-Changed-When: Mon, 28 Jan 2013 20:37:04 +0000
State-Changed-Why:
Fixed in dhcpcd-5.6.7


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.