From yar@yar.chem.msu.su  Sat Oct 21 07:02:14 2000
Return-Path: <yar@yar.chem.msu.su>
Received: from yar.chem.msu.su (yar.chem.msu.ru [195.208.208.25])
	by hub.freebsd.org (Postfix) with ESMTP id 3601837B479
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 21 Oct 2000 07:02:13 -0700 (PDT)
Received: (from yar@localhost)
	by yar.chem.msu.su (8.11.0/8.11.0) id e9LDxqf00443;
	Sat, 21 Oct 2000 17:59:52 +0400 (MSD)
	(envelope-from yar)
Message-Id: <200010211359.e9LDxqf00443@yar.chem.msu.su>
Date: Sat, 21 Oct 2000 17:59:52 +0400 (MSD)
From: yar@comp.chem.msu.su
Sender: yar@yar.chem.msu.su
Reply-To: yar@comp.chem.msu.su
To: FreeBSD-gnats-submit@freebsd.org
Subject: Identical IP addresses on two broadcast interfaces
X-Send-Pr-Version: 3.2

>Number:         22185
>Category:       kern
>Synopsis:       Identical IP addresses on two broadcast interfaces
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 21 07:10:01 PDT 2000
>Closed-Date:    Sun Jul 14 01:24:04 PDT 2002
>Last-Modified:  Sun Jul 14 01:24:04 PDT 2002
>Originator:     Yar Tikhiy
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
Moscow State University
>Environment:

	The bug seems to exist in all branches.

>Description:

	It's possible to add two absolutely identical IP addresses
	to two different broadcast interfaces.

	I guess it would be possible to add different addresses from
	the same network, too.

	The problem arises from in_control()/in_ifinit() leaving the
	address installed even if adding the link-layer route fails.

>How-To-Repeat:

yar# ifconfig fxp0 10.1.1.1
yar# ifconfig fxp1 10.1.1.1
ifconfig: ioctl (SIOCAIFADDR): File exists
yar# ifconfig fxp0 
fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 10.1.1.1 netmask 0xff000000 broadcast 10.255.255.255
        ether 00:d0:b7:60:63:da 
        media: autoselect (100baseTX) status: active
        supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UT
P <full-duplex> 10baseT/UTP
yar# ifconfig fxp1 
fxp1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 10.1.1.1 netmask 0xff000000 broadcast 10.255.255.255
        ether 00:a0:c9:66:67:4d 
        media: autoselect (100baseTX) status: active
        supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UT
P <full-duplex> 10baseT/UTP

>Fix:

	Maybe, the code should try to add the link layer route first,
	and assign the address to the interface only if adding
	the route succeeded?

>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To: yar@comp.chem.msu.su
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: kern/22185: Identical IP addresses on two broadcast interfaces
Date: Fri, 27 Oct 2000 13:00:27 -0400 (EDT)

 <<On Sat, 21 Oct 2000 17:59:52 +0400 (MSD), yar@comp.chem.msu.su said:
 
 > 	Maybe, the code should try to add the link layer route first,
 > 	and assign the address to the interface only if adding
 > 	the route succeeded?
 
 This can't be done, because in order to add the route, the ifaddr must
 already be present.
 
 The trouble is that sometimes this error does not indicate a problem
 (even though it usually does).  I think the right thing is probably to
 compare the new (A1, M1) against all the existing ifaddrs and fail the
 request if any (A2, M2) is present such that M1 == M2 and (A1 & M1) ==
 (A2 & M2).  There may be other conditions which should fail as well.
 
 -GAWollman
 
 --
 Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
 wollman@lcs.mit.edu  | O Siem / The fires of freedom 
 Opinions not those of| Dance in the burning flame
 MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick
 
State-Changed-From-To: open->closed 
State-Changed-By: jon 
State-Changed-When: Sun Jul 14 01:23:11 PDT 2002 
State-Changed-Why:  
fixed, see bin/21292 [src/sys/netinet/in.c 1.44.2.8] 

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