interface name collisions

Nikos Vassiliadis nvass9573 at gmx.com
Tue Aug 25 21:13:20 UTC 2009


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


More information about the freebsd-virtualization mailing list