From owner-freebsd-stable@FreeBSD.ORG Sun Oct 17 14:37:14 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 708BA106564A; Sun, 17 Oct 2010 14:37:14 +0000 (UTC) (envelope-from ndenev@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 15E608FC19; Sun, 17 Oct 2010 14:37:06 +0000 (UTC) Received: by bwz16 with SMTP id 16so19152bwz.13 for ; Sun, 17 Oct 2010 07:37:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type :content-transfer-encoding:subject:date:message-id:to:mime-version :x-mailer; bh=zexa/tU7IaffUYVYD3ZmY4LVrIMGYPL3pCMzU0ZXJOk=; b=R7G+jaHZDDTfPFIinU+pirgQz94bIetmhY9x9tZItRBpaklTnCfQBtSopaYjNXFlQh RVlALPO3qzAzdta9rpt1NIMJ5EEWb6vPc3IYvXa12B6NyFtQXEp7x6Kg1XsSRxVrUgLs QPCJbWejQ4W7eMtERxDHTmjlvbiefRTCLV0tc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; b=Al+lXHTEsHjvyY9Iaei6hR/ZKdXG7QlutC2VOnpVQkUe4WgWuxPWWGWFXbG5BL2Nop wm6mkxS66317d3KL/IB8dxtsuEC4ijN/dZpUdh8x20QexSwf9XvOGcOHTh2RlDEw4bzf fDrIyH7Whs2HlEuIaBlJanOyJUXkmu58UQZEw= Received: by 10.204.101.132 with SMTP id c4mr3308643bko.87.1287324578899; Sun, 17 Oct 2010 07:09:38 -0700 (PDT) Received: from ndenev.totalterror.net (93-152-151-19.ddns.onlinedirect.bg [93.152.151.19]) by mx.google.com with ESMTPS id o12sm14872580bkb.21.2010.10.17.07.09.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 17 Oct 2010 07:09:37 -0700 (PDT) From: Nikolay Denev Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Sun, 17 Oct 2010 17:09:35 +0300 Message-Id: <7051D018-684F-417A-AAA0-00603B2FDCD4@gmail.com> To: freebsd-stable@freebsd.org, freebsd-net@freebsd.org Mime-Version: 1.0 (Apple Message framework v1081) X-Mailer: Apple Mail (2.1081) Cc: Subject: ifconfig, vnets and interface names X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2010 14:37:14 -0000 Hello, While playing with vnet jails I've discovered the following oddity, = which probably is not what's expected to happen : First I'm creating two epair(4) interfaces : [16:51]root@nas:/home/ndenev# ifconfig epair0 create epair0a [16:51]root@nas:/home/ndenev# ifconfig epair1 create epair1a Then I'm creating two vnet jails : [16:51]root@nas:/home/ndenev# jail -c vnet name=3Dtest1 = host.hostname=3Dtest1 path=3D/ persist [16:51]root@nas:/home/ndenev# jail -c vnet name=3Dtest2 = host.hostname=3Dtest2 path=3D/ persist Now push one side of the epairs to each vnet : [16:51]root@nas:/home/ndenev# ifconfig epair0b vnet test1 [16:52]root@nas:/home/ndenev# ifconfig epair1b vnet test2 Rename the interfaces in the vnet jails : [16:52]root@nas:/home/ndenev# jexec test1 ifconfig epair0b name eth0 [16:52]root@nas:/home/ndenev# jexec test2 ifconfig epair1b name eth0 And now I'm destroying the vnets, so all of the interfaces are = "reclaimed" by the host : [16:52]root@nas:/home/ndenev# jail -r test1 [16:52]root@nas:/home/ndenev# jail -r test2 And that's what ifconfig shows after this : [16:52]root@nas:/home/ndenev# ifconfig =20 <... snip lo0 and physical interface ...> epair0a: flags=3D8842 metric 0 = mtu 1500 ether 02:8c:53:00:03:0a epair1a: flags=3D8842 metric 0 = mtu 1500 ether 02:b6:49:00:05:0a eth0: flags=3D8842 metric 0 mtu = 1500 ether 02:8c:53:00:04:0b ether 02:b6:49:00:06:0b Instead of two interfaces, I'm seeing one with to lladdrs, because of = the interface names being the same. Then I'm trying to destroy them : [16:52]root@nas:/home/ndenev# ifconfig eth0 destroy [16:53]root@nas:/home/ndenev# ifconfig=20 <... snip lo0 and physical interface ...> epair1a: flags=3D8842 metric 0 = mtu 1500 ether 02:b6:49:00:05:0a eth0: flags=3D8842 metric 0 mtu = 1500 ether 02:b6:49:00:06:0b [16:53]root@nas:/home/ndenev# ifconfig eth0 destroy So in this case there may be not a clean way to address one of the = interfaces specifically (i.e. destroy only the second one)? I've not investigated further, but I'm thinking probably this is just a = "bug" in ifconfig interpreting/parsing the information from the kernel. Maybe a solution is to extend ifconfig to be able print the interface = list along with the ifIndex values and also manage the interfaces by = index? Auto renaming also is also probably a possible solution (i.e. eth0_1 , = eth0_2 ) as these are interfaces coming from destroyed vnet's and are = not likely to be in use. (but still sounds scary :) ) Regards, Nikolay=