Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Aug 2009 00:12:57 +0300
From:      Nikos Vassiliadis <nvass9573@gmx.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        FreeBSD virtualization mailing list <freebsd-virtualization@freebsd.org>
Subject:   Re: interface name collisions
Message-ID:  <4A9453D9.4020604@gmx.com>
In-Reply-To: <4A9428CF.6050308@elischer.org>
References:  <4A93E416.20200@gmx.com> <4A9428CF.6050308@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A9453D9.4020604>