From nobody@FreeBSD.org  Fri Dec 20 11:18:18 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id 1BE6CCF2
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 20 Dec 2013 11:18:18 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 088DC18B5
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 20 Dec 2013 11:18:18 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rBKBIHiF042833
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 20 Dec 2013 11:18:17 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rBKBIHxX042826;
	Fri, 20 Dec 2013 11:18:17 GMT
	(envelope-from nobody)
Message-Id: <201312201118.rBKBIHxX042826@oldred.freebsd.org>
Date: Fri, 20 Dec 2013 11:18:17 GMT
From: John P Hartmann <jphartmann@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Closing tun<n> interface deconfigures IP address
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         185023
>Category:       kern
>Synopsis:       [tun] Closing tun<n> interface deconfigures IP address
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-net
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 20 11:20:01 UTC 2013
>Closed-Date:    
>Last-Modified:  Tue Jan 07 02:53:35 UTC 2014
>Originator:     John P Hartmann
>Release:        9.1
>Organization:
Self
>Environment:
[root@fb91 ~]# uname -a
FreeBSD fb91.jphartmann.net 9.1-RELEASE-p7 FreeBSD 9.1-RELEASE-p7 #0: Mon Sep  9 21:34:37 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
When a /dev/tun special file is closed, it loses its assigned IP address.  

Looks like it happens near line 467 of if_tun.c (the close routine), but I am not sure exactly where.

>How-To-Repeat:
[root@fb91 ~]# ifconfig tun0 up 10.0.0.103  10.0.0.104
[root@fb91 ~]# ifconfig tun0
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        inet6 fe80::7254:d2ff:fe45:e0a0%tun0 prefixlen 64 scopeid 0x5 
        inet 10.0.0.103 --> 10.0.0.104 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
[root@fb91 ~]# cat /dev/tun0
^C
[root@fb91 ~]# ifconfig tun0
tun0: flags=8010<POINTOPOINT,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

>Fix:


>Release-Note:
>Audit-Trail:

From: "John P. Hartmann" <jphartmann@gmail.com>
To: bug-followup@FreeBSD.org, jphartmann@gmail.com
Cc:  
Subject: Re: kern/185023: Closing tun&lt;n&gt; interface deconfigures IP address
Date: Fri, 20 Dec 2013 12:30:30 +0100

 --001a11c1afc605509a04edf59bfa
 Content-Type: text/plain; charset=ISO-8859-1
 
 Perhaps I should describe my application.
 
 I wish to configure a tun device at boot with an IP address and chown the
 corresponding /dev/tun file to the userID that will use it running
 Hercules.  The other end of the tunnel is an IBM System/360
 channel-to-channel adapter.
 
 I would like to be able to restart Hercules without having to issue
 commands (or ioctl()s) that require root privileges.
 
 Hercules ships a setuid program, hercifc, to set interface parameters by
 ioctl().  I am required to be rid of this trojan horse.
 
 Thanks,
 
    j.
 
 --001a11c1afc605509a04edf59bfa
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 <div dir=3D"ltr"><div><div><div><div><div>Perhaps I should describe my appl=
 ication.<br><br></div>I wish to configure a tun device at boot with an IP a=
 ddress and chown the corresponding /dev/tun file to the userID that will us=
 e it running Hercules.=A0 The other end of the tunnel is an IBM System/360 =
 channel-to-channel adapter.<br>
 <br></div>I would like to be able to restart Hercules without having to iss=
 ue commands (or ioctl()s) that require root privileges.=A0 <br><br></div>He=
 rcules ships a setuid program, hercifc, to set interface parameters by ioct=
 l().=A0 I am required to be rid of this trojan horse.<br>
 <br></div>Thanks,<br><br></div>=A0=A0 j.<br></div>
 
 --001a11c1afc605509a04edf59bfa--

From: "John P. Hartmann" <jphartmann@gmail.com>
To: bug-followup@FreeBSD.org, jphartmann@gmail.com
Cc:  
Subject: Re: kern/185023: Closing tun&lt;n&gt; interface deconfigures IP address
Date: Mon, 6 Jan 2014 13:57:50 +0100

 --089e01634ab4a4867404ef4cceda
 Content-Type: text/plain; charset=ISO-8859-1
 
 The error was introduced by
 http://www.freebsd.org/cgi/query-pr.cgi?pr=100080
 
 --089e01634ab4a4867404ef4cceda
 Content-Type: text/html; charset=ISO-8859-1
 
 <div dir="ltr">The error was introduced by <a href="http://www.freebsd.org/cgi/query-pr.cgi?pr=100080">http://www.freebsd.org/cgi/query-pr.cgi?pr=100080</a><br></div>
 
 --089e01634ab4a4867404ef4cceda--
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Jan 7 02:53:21 UTC 2014 
Responsible-Changed-Why:  
Over to maintainer(s). 

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