From owner-freebsd-virtualization@FreeBSD.ORG Tue Aug 25 13:16:27 2009 Return-Path: Delivered-To: virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E68F106568F for ; Tue, 25 Aug 2009 13:16:27 +0000 (UTC) (envelope-from nvass9573@gmx.com) Received: from mail.gmx.com (unknown [213.165.64.42]) by mx1.freebsd.org (Postfix) with SMTP id 7B86E8FC29 for ; Tue, 25 Aug 2009 13:16:26 +0000 (UTC) Received: (qmail invoked by alias); 25 Aug 2009 13:16:24 -0000 Received: from unknown (EHLO [192.168.23.10]) [79.107.191.15] by mail.gmx.com (mp-eu004) with SMTP; 25 Aug 2009 15:16:24 +0200 X-Authenticated: #46156728 X-Provags-ID: V01U2FsdGVkX1+pUMx2J9ipZHhG8LFQDcn6F1eu8EHZuLqgDfzyUs DcVgBCEpMXbvoH Message-ID: <4A93E416.20200@gmx.com> Date: Tue, 25 Aug 2009 16:16:06 +0300 From: Nikos Vassiliadis User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: virtualization@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.68 Cc: Subject: interface name collisions X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:16:27 -0000 Hello, It seems that there is no checking for name collisions, when an interface is claimed from a child vnet. create ngeth0 > lab# ngctl mkpeer eiface ether ether create test jail > lab# jail -c persist vnet name=test create ngeth0@test > lab# jexec test ngctl mkpeer eiface ether ether claim ngeth0@test > lab# ifconfig ngeth0 -vnet test > lab# ifconfig ngeth0 > ngeth0: flags=8802 metric 0 mtu 1500 > ether 00:00:00:00:00:00 > ether 00:00:00:00:00:00 > lab# Thanks in advance, Nikos From owner-freebsd-virtualization@FreeBSD.ORG Tue Aug 25 18:09:20 2009 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1821106564A for ; Tue, 25 Aug 2009 18:09:20 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outJ.internet-mail-service.net (outj.internet-mail-service.net [216.240.47.233]) by mx1.freebsd.org (Postfix) with ESMTP id BABEE8FC21 for ; Tue, 25 Aug 2009 18:09:20 +0000 (UTC) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 4343B2442; Tue, 25 Aug 2009 11:09:21 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 49FE12D6020; Tue, 25 Aug 2009 11:09:20 -0700 (PDT) Message-ID: <4A9428CF.6050308@elischer.org> Date: Tue, 25 Aug 2009 11:09:19 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Nikos Vassiliadis References: <4A93E416.20200@gmx.com> In-Reply-To: <4A93E416.20200@gmx.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD virtualization mailing list Subject: Re: interface name collisions X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 18:09:20 -0000 Nikos Vassiliadis wrote: > Hello, > > It seems that there is no checking for name collisions, > when an interface is claimed from a child vnet. > > create ngeth0 >> lab# ngctl mkpeer eiface ether ether > create test jail >> lab# jail -c persist vnet name=test > create ngeth0@test >> lab# jexec test ngctl mkpeer eiface ether ether > claim ngeth0@test >> lab# ifconfig ngeth0 -vnet test >> lab# ifconfig ngeth0 >> ngeth0: flags=8802 metric 0 mtu 1500 >> ether 00:00:00:00:00:00 >> ether 00:00:00:00:00:00 >> lab# > > Thanks in advance, Nikos > _______________________________________________ > freebsd-virtualization@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization > To unsubscribe, send any mail to > "freebsd-virtualization-unsubscribe@freebsd.org" you are correct (sort of) The current vnet infrastructure is still under construction and we have been focusing mostly on the functionality rather than error handling, so you will find many places where errors (that are hopefully non fatal) ar enot yet correctly handled. We are aware of this. You are of course also welcome to make suggestions as to what the correct behavior in these situations should be. Thank you for trying out our new little toy! comments and suggestions are always welcome. Note 8.0 vnet support is for demonstration purposes only and we do not suggest that it be used in situations where robust behavior in the face of external or malicios agents might be a factor. i.e. it's not at all hardened (that may be an understatement). From owner-freebsd-virtualization@FreeBSD.ORG Tue Aug 25 21:13:20 2009 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6548A10656A3 for ; Tue, 25 Aug 2009 21:13:20 +0000 (UTC) (envelope-from nvass9573@gmx.com) Received: from mail.gmx.com (unknown [213.165.64.42]) by mx1.freebsd.org (Postfix) with SMTP id AFEB28FC28 for ; Tue, 25 Aug 2009 21:13:19 +0000 (UTC) Received: (qmail invoked by alias); 25 Aug 2009 21:13:17 -0000 Received: from unknown (EHLO [192.168.23.10]) [79.107.191.15] by mail.gmx.com (mp-eu005) with SMTP; 25 Aug 2009 23:13:17 +0200 X-Authenticated: #46156728 X-Provags-ID: V01U2FsdGVkX18+powQcIo+yjY53tKOD7NCPu9NQUVi7nVKqTGkwQ LQQV8HhQ96Z52A Message-ID: <4A9453D9.4020604@gmx.com> Date: Wed, 26 Aug 2009 00:12:57 +0300 From: Nikos Vassiliadis User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Julian Elischer References: <4A93E416.20200@gmx.com> <4A9428CF.6050308@elischer.org> In-Reply-To: <4A9428CF.6050308@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.53 Cc: FreeBSD virtualization mailing list Subject: Re: interface name collisions X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 21:13:20 -0000 Julian Elischer wrote: > We are aware of this. You are of course also welcome to > make suggestions as to what the correct behavior in these > situations should be. > When an interface is moved from a parent to a child vnet a check is done. I tried to copy that behavior. Does it look correct? --- sys/net/if.c.orig 2009-08-24 15:52:05.000000000 +0300 +++ sys/net/if.c 2009-08-25 23:55:26.000000000 +0300 @@ -992,6 +992,13 @@ prison_hold_locked(pr); mtx_unlock(&pr->pr_mtx); + /* Make sure the named iface does not exist in the dst. prison/vnet. */ + ifp = ifunit(ifname); + if (ifp != NULL) { + prison_free(pr); + return (EEXIST); + } + /* Make sure the named iface exists in the source prison/vnet. */ CURVNET_SET(pr->pr_vnet); ifp = ifunit(ifname); /* XXX Lock to avoid races. */ > Thank you for trying out our new little toy! Well, thanks for creating this "little toy":) Nikos From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 26 06:22:03 2009 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E24AB106568C for ; Wed, 26 Aug 2009 06:22:03 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 9E1D88FC21 for ; Wed, 26 Aug 2009 06:22:03 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id ED4D041C6B4; Wed, 26 Aug 2009 08:05:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id QsnSH+xe-l1l; Wed, 26 Aug 2009 08:05:06 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 525CA41C6A7; Wed, 26 Aug 2009 08:05:06 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 848E54448E6; Wed, 26 Aug 2009 06:00:57 +0000 (UTC) Date: Wed, 26 Aug 2009 06:00:57 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Nikos Vassiliadis In-Reply-To: <4A9453D9.4020604@gmx.com> Message-ID: <20090826055308.C93661@maildrop.int.zabbadoz.net> References: <4A93E416.20200@gmx.com> <4A9428CF.6050308@elischer.org> <4A9453D9.4020604@gmx.com> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: FreeBSD virtualization mailing list Subject: Re: interface name collisions X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 06:22:04 -0000 On Wed, 26 Aug 2009, Nikos Vassiliadis wrote: Hi, > When an interface is moved from a parent to a child vnet > a check is done. I tried to copy that behavior. Does it > look correct? > > --- sys/net/if.c.orig 2009-08-24 15:52:05.000000000 +0300 > +++ sys/net/if.c 2009-08-25 23:55:26.000000000 +0300 > @@ -992,6 +992,13 @@ > prison_hold_locked(pr); > mtx_unlock(&pr->pr_mtx); > > + /* Make sure the named iface does not exist in the dst. prison/vnet. > */ > + ifp = ifunit(ifname); > + if (ifp != NULL) { > + prison_free(pr); > + return (EEXIST); > + } > + > /* Make sure the named iface exists in the source prison/vnet. */ > CURVNET_SET(pr->pr_vnet); > ifp = ifunit(ifname); /* XXX Lock to avoid races. */ I hope there would be a comment somewhere that vmomve should be re-done to fix all this... it was in the commit message: :: There is some duplicate interface name checking before actually moving :: the interface between network stacks without locking and thus race :: prone. Ideally if_vmove will correctly and automagically handle these :: in the future. So what you do above replicates this behaviour but doesn't really make it better as you still may run into the problem only less likely. Robert is currently fixing other if.c bugs for ifindex allocation (proper locking, reducing races,..), so I am satying away from there to not interfere with his work but hope to go back there next week, when the if.c code has settled. /bz -- Bjoern A. Zeeb What was I talking about and who are you again? From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 26 10:01:47 2009 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 999A7106568B for ; Wed, 26 Aug 2009 10:01:47 +0000 (UTC) (envelope-from nvass9573@gmx.com) Received: from mail.gmx.com (unknown [213.165.64.42]) by mx1.freebsd.org (Postfix) with SMTP id E15588FC27 for ; Wed, 26 Aug 2009 10:01:46 +0000 (UTC) Received: (qmail invoked by alias); 26 Aug 2009 10:01:45 -0000 Received: from adsl-23.79.107.25.tellas.gr (EHLO [192.168.23.10]) [79.107.25.23] by mail.gmx.com (mp-eu001) with SMTP; 26 Aug 2009 12:01:45 +0200 X-Authenticated: #46156728 X-Provags-ID: V01U2FsdGVkX1+uDNYdPHKuQA8qCaRS1xDdejE7JepT0hMwY9Fh25 Vd/DD/+fqThzga Message-ID: <4A9507ED.4020207@gmx.com> Date: Wed, 26 Aug 2009 13:01:17 +0300 From: Nikos Vassiliadis User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <4A93E416.20200@gmx.com> <4A9428CF.6050308@elischer.org> <4A9453D9.4020604@gmx.com> <20090826055308.C93661@maildrop.int.zabbadoz.net> In-Reply-To: <20090826055308.C93661@maildrop.int.zabbadoz.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.76 Cc: FreeBSD virtualization mailing list Subject: Re: interface name collisions X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 10:01:47 -0000 Bjoern A. Zeeb wrote: > Robert is currently fixing other if.c bugs for ifindex allocation (proper > locking, reducing races,..), so I am satying away from there to not > interfere with his work but hope to go back there next week, when the if.c > code has settled. Ah I see, thanks for the information. Nikos