return true;
}
-static bool containMount(struct mounts_t *mpt, const char *dst)
+static bool containMount(struct nsjconf_t *nsjconf, struct mounts_t *mpt, const char *dst)
{
LOG_D("Mounting '%s' on '%s' (type:'%s', flags:0x%tx)", mpt->src, dst, mpt->fs_type,
mpt->flags);
}
if (mount(mpt->src, dst, mpt->fs_type, mpt->flags, mpt->options) == -1) {
- PLOG_E("mount('%s', '%s', type='%s')", mpt->src, dst, mpt->fs_type);
+ if (errno == EACCES) {
+ PLOG_E
+ ("mount('%s', '%s', type='%s') failed. Try fixing this problem by applying 'chmod o+x' to the '%s' directory and its ancestors",
+ mpt->src, dst, mpt->fs_type, nsjconf->chroot);
+ } else {
+ PLOG_E("mount('%s', '%s', type='%s') failed", mpt->src, dst, mpt->fs_type);
+ }
return false;
}
return true;
TAILQ_FOREACH(p, &nsjconf->mountpts, pointers) {
char dst[PATH_MAX];
snprintf(dst, sizeof(dst), "%s/%s", newrootdir, p->dst);
- if (containMount(p, dst) == false) {
+ if (containMount(nsjconf, p, dst) == false) {
return false;
}
}
return false;
}
if (addr.s_addr == INADDR_ANY) {
- LOG_I("IP address for interface '%s' not set", IFACE_NAME);
+ LOG_I("IPv4 address for interface '%s' not set", IFACE_NAME);
return true;
}
}
if (inet_pton(AF_INET, nsjconf->iface_vs_nm, &addr) != 1) {
- PLOG_E("Cannot convert '%s' into an IPv4 netmask", nsjconf->iface_vs_nm);
+ PLOG_E("Cannot convert '%s' into a IPv4 netmask", nsjconf->iface_vs_nm);
close(sock);
return false;
}
}
if (inet_pton(AF_INET, nsjconf->iface_vs_gw, &addr) != 1) {
- PLOG_E("Cannot convert '%s' into an IPv4 GW address", nsjconf->iface_vs_gw);
+ PLOG_E("Cannot convert '%s' into a IPv4 GW address", nsjconf->iface_vs_gw);
close(sock);
return false;
}
if (addr.s_addr == INADDR_ANY) {
- LOG_I("Gateway address for '%s' is 0.0.0.0. Not adding the default route",
- IFACE_NAME);
+ LOG_I("Gateway address for '%s' is not set", IFACE_NAME);
return true;
}
sgate->sin_addr = addr;
rt.rt_flags = RTF_UP | RTF_GATEWAY;
+ rt.rt_dev = IFACE_NAME;
if (ioctl(sock, SIOCADDRT, &rt) == -1) {
PLOG_E("ioctl(SIOCADDRT, '%s')", nsjconf->iface_vs_gw);