diff options
Diffstat (limited to 'src/dumm')
-rw-r--r-- | src/dumm/Makefile.in | 1 | ||||
-rw-r--r-- | src/dumm/bridge.c | 22 | ||||
-rw-r--r-- | src/dumm/cowfs.c | 16 | ||||
-rw-r--r-- | src/dumm/dumm.c | 11 | ||||
-rw-r--r-- | src/dumm/guest.c | 20 | ||||
-rw-r--r-- | src/dumm/iface.c | 14 | ||||
-rw-r--r-- | src/dumm/mconsole.c | 22 |
7 files changed, 59 insertions, 47 deletions
diff --git a/src/dumm/Makefile.in b/src/dumm/Makefile.in index 8bc08e2c1..36fdbff28 100644 --- a/src/dumm/Makefile.in +++ b/src/dumm/Makefile.in @@ -226,6 +226,7 @@ ipsecuid = @ipsecuid@ ipsecuser = @ipsecuser@ libdir = @libdir@ libexecdir = @libexecdir@ +libhydra_plugins = @libhydra_plugins@ libstrongswan_plugins = @libstrongswan_plugins@ linux_headers = @linux_headers@ localedir = @localedir@ diff --git a/src/dumm/bridge.c b/src/dumm/bridge.c index 592fecefd..9c63beed9 100644 --- a/src/dumm/bridge.c +++ b/src/dumm/bridge.c @@ -69,8 +69,8 @@ static bool disconnect_iface(private_bridge_t *this, iface_t *iface) { if (br_del_interface(this->name, iface->get_hostif(iface)) != 0) { - DBG1("removing iface '%s' from bridge '%s' in kernel failed: %m", - iface->get_hostif(iface), this->name); + DBG1(DBG_LIB, "removing iface '%s' from bridge '%s' in kernel" + " failed: %m", iface->get_hostif(iface), this->name); } else { @@ -83,8 +83,8 @@ static bool disconnect_iface(private_bridge_t *this, iface_t *iface) } if (iface != current) { - DBG1("iface '%s' not found on bridge '%s'", iface->get_hostif(iface), - this->name); + DBG1(DBG_LIB, "iface '%s' not found on bridge '%s'", + iface->get_hostif(iface), this->name); } enumerator->destroy(enumerator); return good; @@ -97,7 +97,7 @@ static bool connect_iface(private_bridge_t *this, iface_t *iface) { if (br_add_interface(this->name, iface->get_hostif(iface)) != 0) { - DBG1("adding iface '%s' to bridge '%s' failed: %m", + DBG1(DBG_LIB, "adding iface '%s' to bridge '%s' failed: %m", iface->get_hostif(iface), this->name); return FALSE; } @@ -124,7 +124,8 @@ static void destroy(private_bridge_t *this) { if (br_del_interface(this->name, iface->get_hostif(iface)) != 0) { - DBG1("disconnecting iface '%s' failed: %m", iface->get_hostif(iface)); + DBG1(DBG_LIB, "disconnecting iface '%s' failed: %m", + iface->get_hostif(iface)); } iface->set_bridge(iface, NULL); } @@ -133,7 +134,8 @@ static void destroy(private_bridge_t *this) iface_control(this->name, FALSE); if (br_del_bridge(this->name) != 0) { - DBG1("deleting bridge '%s' from kernel failed: %m", this->name); + DBG1(DBG_LIB, "deleting bridge '%s' from kernel failed: %m", + this->name); } free(this->name); free(this); @@ -154,7 +156,7 @@ bridge_t *bridge_create(char *name) { if (br_init() != 0) { - DBG1("libbridge initialization failed: %m"); + DBG1(DBG_LIB, "libbridge initialization failed: %m"); return NULL; } } @@ -168,13 +170,13 @@ bridge_t *bridge_create(char *name) if (br_add_bridge(name) != 0) { - DBG1("creating bridge '%s' failed: %m", name); + DBG1(DBG_LIB, "creating bridge '%s' failed: %m", name); free(this); return NULL; } if (!iface_control(name, TRUE)) { - DBG1("bringing bridge '%s' up failed: %m", name); + DBG1(DBG_LIB, "bringing bridge '%s' up failed: %m", name); } this->name = strdup(name); diff --git a/src/dumm/cowfs.c b/src/dumm/cowfs.c index f7b6b0cf3..70767890b 100644 --- a/src/dumm/cowfs.c +++ b/src/dumm/cowfs.c @@ -493,12 +493,12 @@ static int cowfs_link(const char *from, const char *to) if (!clone_path(rd, wr, to)) { - DBG1("cloning path '%s' failed", to); + DBG1(DBG_LIB, "cloning path '%s' failed", to); return -errno; } if (linkat(rd, from, wr, to, 0) < 0) { - DBG1("linking '%s' to '%s' failed", from, to); + DBG1(DBG_LIB, "linking '%s' to '%s' failed", from, to); return -errno; } return 0; @@ -777,7 +777,7 @@ static bool set_overlay(private_cowfs_t *this, char *path) this->over_fd = open(path, O_RDONLY | O_DIRECTORY); if (this->over_fd < 0) { - DBG1("failed to open overlay directory '%s': %m", path); + DBG1(DBG_LIB, "failed to open overlay directory '%s': %m", path); return FALSE; } this->over = strdup(path); @@ -821,14 +821,14 @@ cowfs_t *cowfs_create(char *master, char *host, char *mount) this->master_fd = open(master, O_RDONLY | O_DIRECTORY); if (this->master_fd < 0) { - DBG1("failed to open master filesystem '%s'", master); + DBG1(DBG_LIB, "failed to open master filesystem '%s'", master); free(this); return NULL; } this->host_fd = open(host, O_RDONLY | O_DIRECTORY); if (this->host_fd < 0) { - DBG1("failed to open host filesystem '%s'", host); + DBG1(DBG_LIB, "failed to open host filesystem '%s'", host); close(this->master_fd); free(this); return NULL; @@ -838,7 +838,7 @@ cowfs_t *cowfs_create(char *master, char *host, char *mount) this->chan = fuse_mount(mount, &args); if (this->chan == NULL) { - DBG1("mounting cowfs FUSE on '%s' failed", mount); + DBG1(DBG_LIB, "mounting cowfs FUSE on '%s' failed", mount); close(this->master_fd); close(this->host_fd); free(this); @@ -849,7 +849,7 @@ cowfs_t *cowfs_create(char *master, char *host, char *mount) sizeof(cowfs_operations), this); if (this->fuse == NULL) { - DBG1("creating cowfs FUSE handle failed"); + DBG1(DBG_LIB, "creating cowfs FUSE handle failed"); close(this->master_fd); close(this->host_fd); fuse_unmount(mount, this->chan); @@ -865,7 +865,7 @@ cowfs_t *cowfs_create(char *master, char *host, char *mount) this->thread = thread_create((thread_main_t)fuse_loop, this->fuse); if (!this->thread) { - DBG1("creating thread to handle FUSE failed"); + DBG1(DBG_LIB, "creating thread to handle FUSE failed"); fuse_unmount(mount, this->chan); free(this->mount); free(this->master); diff --git a/src/dumm/dumm.c b/src/dumm/dumm.c index 0e8ab43f3..7ec340089 100644 --- a/src/dumm/dumm.c +++ b/src/dumm/dumm.c @@ -162,7 +162,7 @@ static bool load_template(private_dumm_t *this, char *dir) } if (strlen(dir) > PATH_MAX) { - DBG1("template directory string '%s' is too long", dir); + DBG1(DBG_LIB, "template directory string '%s' is too long", dir); return FALSE; } @@ -175,7 +175,8 @@ static bool load_template(private_dumm_t *this, char *dir) { /* does not exist, create template */ if (!mkdir_p(this->template, PERME)) { - DBG1("creating template directory '%s' failed: %m", this->template); + DBG1(DBG_LIB, "creating template directory '%s' failed: %m", + this->template); return FALSE; } } @@ -302,7 +303,8 @@ static void load_guests(private_dumm_t *this) } else { - DBG1("loading guest in directory '%s' failed, skipped", ent->d_name); + DBG1(DBG_LIB, "loading guest in directory '%s' failed, skipped", + ent->d_name); } } closedir(dir); @@ -360,7 +362,8 @@ dumm_t *dumm_create(char *dir) if (this->dir == NULL || this->guest_dir == NULL || (mkdir(this->guest_dir, PERME) < 0 && errno != EEXIST)) { - DBG1("creating guest directory '%s' failed: %m", this->guest_dir); + DBG1(DBG_LIB, "creating guest directory '%s' failed: %m", + this->guest_dir); destroy(this); return NULL; } diff --git a/src/dumm/guest.c b/src/dumm/guest.c index 112adb441..ebd87769a 100644 --- a/src/dumm/guest.c +++ b/src/dumm/guest.c @@ -100,7 +100,8 @@ static iface_t* create_iface(private_guest_t *this, char *name) if (this->state != GUEST_RUNNING) { - DBG1("guest '%s' not running, unable to add interface", this->name); + DBG1(DBG_LIB, "guest '%s' not running, unable to add interface", + this->name); return NULL; } @@ -109,7 +110,8 @@ static iface_t* create_iface(private_guest_t *this, char *name) { if (streq(name, iface->get_guestif(iface))) { - DBG1("guest '%s' already has an interface '%s'", this->name, name); + DBG1(DBG_LIB, "guest '%s' already has an interface '%s'", + this->name, name); enumerator->destroy(enumerator); return NULL; } @@ -251,7 +253,8 @@ static bool start(private_guest_t *this, invoke_function_t invoke, void* data, if (this->state != GUEST_STOPPED) { - DBG1("unable to start guest in state %N", guest_state_names, this->state); + DBG1(DBG_LIB, "unable to start guest in state %N", guest_state_names, + this->state); return FALSE; } this->state = GUEST_STARTING; @@ -284,7 +287,7 @@ static bool start(private_guest_t *this, invoke_function_t invoke, void* data, this->mconsole = mconsole_create(notify, idle); if (this->mconsole == NULL) { - DBG1("opening mconsole at '%s' failed, stopping guest", buf); + DBG1(DBG_LIB, "opening mconsole at '%s' failed, stopping guest", buf); stop(this, NULL); return FALSE; } @@ -315,7 +318,8 @@ static bool load_template(private_guest_t *this, char *path) { if (!mkdir_p(dir, PERME)) { - DBG1("creating overlay for guest '%s' failed: %m", this->name); + DBG1(DBG_LIB, "creating overlay for guest '%s' failed: %m", + this->name); return FALSE; } } @@ -595,7 +599,7 @@ static private_guest_t *guest_create_generic(char *parent, char *name, this->dir = open(this->dirname, O_DIRECTORY, PERME); if (this->dir < 0) { - DBG1("opening guest directory '%s' failed: %m", this->dirname); + DBG1(DBG_LIB, "opening guest directory '%s' failed: %m", this->dirname); free(this->dirname); free(this); return NULL; @@ -647,7 +651,7 @@ guest_t *guest_create(char *parent, char *name, char *kernel, if (!make_symlink(this, master, MASTER_DIR) || !make_symlink(this, kernel, KERNEL_FILE)) { - DBG1("creating master/kernel symlink failed: %m"); + DBG1(DBG_LIB, "creating master/kernel symlink failed: %m"); destroy(this); return NULL; } @@ -655,7 +659,7 @@ guest_t *guest_create(char *parent, char *name, char *kernel, if (mkdirat(this->dir, UNION_DIR, PERME) != 0 || mkdirat(this->dir, DIFF_DIR, PERME) != 0) { - DBG1("unable to create directories for '%s': %m", name); + DBG1(DBG_LIB, "unable to create directories for '%s': %m", name); destroy(this); return NULL; } diff --git a/src/dumm/iface.c b/src/dumm/iface.c index 9910c392e..1b5b7d717 100644 --- a/src/dumm/iface.c +++ b/src/dumm/iface.c @@ -196,7 +196,7 @@ static bool destroy_tap(private_iface_t *this) if (!iface_control(this->hostif, FALSE)) { - DBG1("bringing iface down failed: %m"); + DBG1(DBG_LIB, "bringing iface down failed: %m"); } memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; @@ -205,13 +205,13 @@ static bool destroy_tap(private_iface_t *this) tap = open(TAP_DEVICE, O_RDWR); if (tap < 0) { - DBG1("unable to open tap device %s: %m", TAP_DEVICE); + DBG1(DBG_LIB, "unable to open tap device %s: %m", TAP_DEVICE); return FALSE; } if (ioctl(tap, TUNSETIFF, &ifr) < 0 || ioctl(tap, TUNSETPERSIST, 0) < 0) { - DBG1("removing %s failed: %m", this->hostif); + DBG1(DBG_LIB, "removing %s failed: %m", this->hostif); close(tap); return FALSE; } @@ -235,14 +235,14 @@ static char* create_tap(private_iface_t *this) tap = open(TAP_DEVICE, O_RDWR); if (tap < 0) { - DBG1("unable to open tap device %s: %m", TAP_DEVICE); + DBG1(DBG_LIB, "unable to open tap device %s: %m", TAP_DEVICE); return NULL; } if (ioctl(tap, TUNSETIFF, &ifr) < 0 || ioctl(tap, TUNSETPERSIST, 1) < 0 || ioctl(tap, TUNSETOWNER, 0)) { - DBG1("creating new tap device failed: %m"); + DBG1(DBG_LIB, "creating new tap device failed: %m"); close(tap); return NULL; } @@ -299,7 +299,7 @@ iface_t *iface_create(char *name, guest_t *guest, mconsole_t *mconsole) } if (!this->mconsole->add_iface(this->mconsole, this->guestif, this->hostif)) { - DBG1("creating interface '%s' in guest failed", this->guestif); + DBG1(DBG_LIB, "creating interface '%s' in guest failed", this->guestif); destroy_tap(this); free(this->guestif); free(this->hostif); @@ -308,7 +308,7 @@ iface_t *iface_create(char *name, guest_t *guest, mconsole_t *mconsole) } if (!iface_control(this->hostif, TRUE)) { - DBG1("bringing iface '%s' up failed: %m", this->hostif); + DBG1(DBG_LIB, "bringing iface '%s' up failed: %m", this->hostif); } return &this->public; } diff --git a/src/dumm/mconsole.c b/src/dumm/mconsole.c index 35984bdd5..7d982a54c 100644 --- a/src/dumm/mconsole.c +++ b/src/dumm/mconsole.c @@ -120,7 +120,7 @@ static int request(private_mconsole_t *this, void(*cb)(void*,char*,size_t), if (len < 0) { - DBG1("sending mconsole command to UML failed: %m"); + DBG1(DBG_LIB, "sending mconsole command to UML failed: %m"); return -1; } do @@ -136,7 +136,7 @@ static int request(private_mconsole_t *this, void(*cb)(void*,char*,size_t), } if (len < 0) { - DBG1("receiving from mconsole failed: %m"); + DBG1(DBG_LIB, "receiving from mconsole failed: %m"); return -1; } if (len > 0) @@ -149,7 +149,7 @@ static int request(private_mconsole_t *this, void(*cb)(void*,char*,size_t), { if (reply.len && *reply.data) { - DBG1("received mconsole error %d: %.*s", + DBG1(DBG_LIB, "received mconsole error %d: %.*s", reply.err, reply.len, reply.data); } break; @@ -245,7 +245,7 @@ static bool wait_for_notify(private_mconsole_t *this, char *nsock) this->notify = socket(AF_UNIX, SOCK_DGRAM, 0); if (this->notify < 0) { - DBG1("opening mconsole notify socket failed: %m"); + DBG1(DBG_LIB, "opening mconsole notify socket failed: %m"); return FALSE; } memset(&addr, 0, sizeof(addr)); @@ -253,7 +253,8 @@ static bool wait_for_notify(private_mconsole_t *this, char *nsock) strncpy(addr.sun_path, nsock, sizeof(addr.sun_path)); if (bind(this->notify, (struct sockaddr*)&addr, sizeof(addr)) < 0) { - DBG1("binding mconsole notify socket to '%s' failed: %m", nsock); + DBG1(DBG_LIB, "binding mconsole notify socket to '%s' failed: %m", + nsock); close(this->notify); return FALSE; } @@ -273,7 +274,7 @@ static bool wait_for_notify(private_mconsole_t *this, char *nsock) if (len < 0 || len >= sizeof(notify)) { - DBG1("reading from mconsole notify socket failed: %m"); + DBG1(DBG_LIB, "reading from mconsole notify socket failed: %m"); close(this->notify); unlink(nsock); return FALSE; @@ -282,8 +283,8 @@ static bool wait_for_notify(private_mconsole_t *this, char *nsock) notify.version != MCONSOLE_VERSION || notify.type != MCONSOLE_SOCKET) { - DBG1("received unexpected message from mconsole notify socket: %b", - ¬ify, sizeof(notify)); + DBG1(DBG_LIB, "received unexpected message from mconsole notify" + " socket: %b", ¬ify, sizeof(notify)); close(this->notify); unlink(nsock); return FALSE; @@ -304,7 +305,7 @@ static bool setup_console(private_mconsole_t *this) this->console = socket(AF_UNIX, SOCK_DGRAM, 0); if (this->console < 0) { - DBG1("opening mconsole socket failed: %m"); + DBG1(DBG_LIB, "opening mconsole socket failed: %m"); return FALSE; } memset(&addr, 0, sizeof(addr)); @@ -313,7 +314,8 @@ static bool setup_console(private_mconsole_t *this) getpid(), this->console); if (bind(this->console, (struct sockaddr*)&addr, sizeof(addr)) < 0) { - DBG1("binding mconsole socket to '%s' failed: %m", &addr.sun_path[1]); + DBG1(DBG_LIB, "binding mconsole socket to '%s' failed: %m", + &addr.sun_path[1]); close(this->console); return FALSE; } |