fixed mconsole when using multiple guests
authorMartin Willi <martin@strongswan.org>
Wed, 25 Jul 2007 14:05:06 +0000 (14:05 -0000)
committerMartin Willi <martin@strongswan.org>
Wed, 25 Jul 2007 14:05:06 +0000 (14:05 -0000)
fixed interface enumeration bug

src/dumm/iface.c
src/dumm/main.c
src/dumm/mconsole.c

index 9e690d4..2bc8a3e 100644 (file)
@@ -89,7 +89,8 @@ static char* create_tap(private_iface_t *this)
        ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
        
        if (ioctl(this->tap, TUNSETIFF, &ifr) < 0 ||
-               ioctl(this->tap, TUNSETPERSIST, 1) < 0)
+               ioctl(this->tap, TUNSETPERSIST, 1) < 0 ||
+               ioctl(this->tap, TUNSETOWNER, 0))
     {
                DBG1("creating new tap device failed: %m");
                return NULL;
index 7e22ddf..5d3cbbd 100644 (file)
@@ -225,6 +225,7 @@ static void guest(dumm_t *dumm, char *name)
                if (streq(name, guest->get_name(guest)))
                {
                        found = TRUE;
+                       break;
                }
        }
        iterator->destroy(iterator);
index b782ebe..7735e52 100644 (file)
@@ -154,7 +154,7 @@ mconsole_t *mconsole_create(char *sock)
        }
        memset(&addr, 0, sizeof(addr));
        addr.sun_family = AF_UNIX;
-       sprintf(&addr.sun_path[1], "%5d", getpid());
+       sprintf(&addr.sun_path[1], "%5d-%s", getpid(), sock);
        if (bind(this->socket, (struct sockaddr*)&addr, sizeof(addr)) < 0)
        {
                DBG1("binding mconsole socket failed: %m");