From bif@42.pl  Mon Feb 21 17:27:12 2011
Return-Path: <bif@42.pl>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8E8BA106566C
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 21 Feb 2011 17:27:12 +0000 (UTC)
	(envelope-from bif@42.pl)
Received: from 42.pl (42.pl [79.98.145.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 285A48FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 21 Feb 2011 17:27:11 +0000 (UTC)
Received: from 42.pl (localhost [127.0.0.1])
	by 42.pl (8.14.4/8.14.4) with ESMTP id p1LHESXF082392
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 21 Feb 2011 18:14:28 +0100 (CET)
	(envelope-from bif@42.pl)
Received: (from bif@localhost)
	by 42.pl (8.14.4/8.14.4/Submit) id p1LHENQl082391;
	Mon, 21 Feb 2011 18:14:23 +0100 (CET)
	(envelope-from bif)
Message-Id: <201102211714.p1LHENQl082391@42.pl>
Date: Mon, 21 Feb 2011 18:14:23 +0100 (CET)
From: Piotr KUCHARSKI <nospam@42.pl>
Reply-To: Piotr KUCHARSKI <nospam@42.pl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: ifconfig gifX create on existing gifX clears IP
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         154943
>Category:       kern
>Synopsis:       [gif] ifconfig gifX create on existing gifX clears IP
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-net
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 21 17:30:09 UTC 2011
>Closed-Date:    
>Last-Modified:  Wed Feb 23 14:40:09 UTC 2011
>Originator:     Piotr KUCHARSKI
>Release:        FreeBSD 8.2-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD 8.2-PRERELEASE #18 r218734M: Wed Feb 16 18:19:49 CET 2011
with zfs 28 patches applied (though it should not matter)

>Description:
	erroneous 'ifconfig gifX create' (on a wrong gif interface) clears
  existing IP assignments (which of course destroys all tcp connections using it)

  this seems like a regression from 8.1

>How-To-Repeat:
# ifconfig gif5 create
# ifconfig gif5 tunnel 172.16.0.1 172.31.255.254
# ifconfig gif5 10.0.0.1 10.0.0.2
# ifconfig gif5
gif5: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
        tunnel inet 172.16.0.1 --> 172.31.255.254
        inet 10.0.0.1 --> 10.0.0.2 netmask 0xff000000 
        options=1<ACCEPT_REV_ETHIP_VER>
# ping 10.0.0.2  # just to verify it works, even if it should not matter
64 bytes from 10.0.0.2: icmp_seq=0 ttl=64 time=27.267 ms
# ifconfig gif5 create
ifconfig: ioctl (SIOCAIFADDR): Destination address required
# ifconfig gif5
gif5: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
        tunnel inet 172.16.0.1 --> 172.31.255.254
        options=1<ACCEPT_REV_ETHIP_VER>
>Fix:

	


>Release-Note:
>Audit-Trail:

From: Piotr KUCHARSKI <nospam@42.pl>
To: bug-followup@FreeBSD.org, nospam@42.pl
Cc:  
Subject: Re: misc/154943: ifconfig gifX create on existing gifX clears IP
Date: Mon, 21 Feb 2011 21:00:26 +0100

 Uhm. I guess it's kind of a false alarm, not regression from 8.1 :)
 
 The problem is this:
 
 # getent hosts create
 85.128.167.158    create.pl
 
 so ifconfig sees that gif5 interface exists and so decides I wanted to
 change the IP and resolves "create", gets the IP, and basically executes:
 
 # ifconfig gif3 85.128.167.158
 ifconfig: ioctl (SIOCAIFADDR): Destination address required
 
 IMHO it still should not clear the old address in this case.
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Feb 22 03:30:43 UTC 2011 
Responsible-Changed-Why:  
reclassify. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=154943 

From: Piotr KUCHARSKI <nospam@42.pl>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: misc/154943: ifconfig gifX create on existing gifX clears IP
Date: Wed, 23 Feb 2011 15:34:27 +0100

 I also found why 'getent hosts create' was resolving:
 my resolv.conf had no "search" option set, and manual says:
 
   search      Search list for host-name lookup.  The search list is nor‐
               mally determined from the local domain name; by default, it
               contains only the local domain name.
 
 My hostname is 42.pl, same as domain name, but I guess some code
 simply chops off first component and domain name was automatically
 set to "pl" and getent found "create.pl".
 
 How about not chopping off first component in such a case? :)
 
 In addition to not resolving ifconfig command names? :)
>Unformatted:
