iface -> iface_vs
authorRobert Swiecki <robert@swiecki.net>
Mon, 12 Jun 2017 20:20:21 +0000 (22:20 +0200)
committerRobert Swiecki <robert@swiecki.net>
Mon, 12 Jun 2017 20:20:21 +0000 (22:20 +0200)
cmdline.c
common.h
config.c
net.c

index 82e0f1159febe838bb58d04304b742ea657bd5ea..4f61380b03ec1776d2cd449b6fc5631145c41f71 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
@@ -345,7 +345,7 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
       .cgroup_pids_parent = "NSJAIL",
       .cgroup_pids_max = (size_t)0,
       .iface_no_lo = false,
-      .iface = NULL,
+      .iface_vs = NULL,
       .iface_vs_ip = "0.0.0.0",
       .iface_vs_nm = "255.255.255.0",
       .iface_vs_gw = "0.0.0.0",
@@ -676,7 +676,7 @@ bool cmdlineParse(int argc, char *argv[], struct nsjconf_t * nsjconf)
                        nsjconf->iface_no_lo = true;
                        break;
                case 'I':
-                       nsjconf->iface = optarg;
+                       nsjconf->iface_vs = optarg;
                        break;
                case 0x701:
                        nsjconf->iface_vs_ip = optarg;
index 547f5984ed4759c0967fdf7e4cc72a8f91c59fd7..f848a7c07dffeab98e8265b04f4d29e21565e0a9 100644 (file)
--- a/common.h
+++ b/common.h
@@ -151,7 +151,7 @@ struct nsjconf_t {
        size_t tmpfs_size;
        bool mount_proc;
        bool iface_no_lo;
-       const char *iface;
+       const char *iface_vs;
        const char *iface_vs_ip;
        const char *iface_vs_nm;
        const char *iface_vs_gw;
index 4831c15067fa23e1ee275f45557643d6df9b0944..7abffc62fa7972a25d101b4bf0e9d317a0a34669 100644 (file)
--- a/config.c
+++ b/config.c
@@ -223,7 +223,7 @@ static bool configParseInternal(struct nsjconf_t *nsjconf, Nsjail__NsJailConfig
        nsjconf->cgroup_pids_parent = utilStrDup(njc->cgroup_pids_parent);
 
        nsjconf->iface_no_lo = njc->iface_no_lo;
-       nsjconf->iface = utilStrDup(njc->macvlan_iface);
+       nsjconf->iface_vs = utilStrDup(njc->macvlan_iface);
        nsjconf->iface_vs_ip = utilStrDup(njc->macvlan_vs_ip);
        nsjconf->iface_vs_nm = utilStrDup(njc->macvlan_vs_nm);
        nsjconf->iface_vs_gw = utilStrDup(njc->macvlan_vs_gw);
diff --git a/net.c b/net.c
index fd6fff1cd8b3c6e2c5e50703ae3af4008ac4b320..b7bd3d5bfba47757add5b00dd1bf05a37b30ffea 100644 (file)
--- a/net.c
+++ b/net.c
@@ -55,11 +55,11 @@ bool netInitNsFromParent(struct nsjconf_t *nsjconf, int pid)
        if (nsjconf->clone_newnet == false) {
                return true;
        }
-       if (nsjconf->iface == NULL) {
+       if (nsjconf->iface_vs == NULL) {
                return true;
        }
 
-       LOG_D("Putting iface:'%s' into namespace of PID:%d (with libnl3)", nsjconf->iface, pid);
+       LOG_D("Putting iface:'%s' into namespace of PID:%d (with libnl3)", nsjconf->iface_vs, pid);
 
        struct nl_sock *sk = nl_socket_alloc();
        if (sk == NULL) {
@@ -89,9 +89,9 @@ bool netInitNsFromParent(struct nsjconf_t *nsjconf, int pid)
                return false;
        }
 
-       int master_index = rtnl_link_name2i(link_cache, nsjconf->iface);
+       int master_index = rtnl_link_name2i(link_cache, nsjconf->iface_vs);
        if (master_index == 0) {
-               LOG_E("rtnl_link_name2i(): Did not find '%s' interface", nsjconf->iface);
+               LOG_E("rtnl_link_name2i(): Did not find '%s' interface", nsjconf->iface_vs);
                nl_cache_free(link_cache);
                rtnl_link_put(rmv);
                nl_socket_free(sk);
@@ -122,22 +122,23 @@ bool netInitNsFromParent(struct nsjconf_t *nsjconf, int pid)
        if (nsjconf->clone_newnet == false) {
                return true;
        }
-       if (nsjconf->iface == NULL) {
+       if (nsjconf->iface_vs == NULL) {
                return true;
        }
 
-       LOG_D("Putting iface:'%s' into namespace of PID:%d (with /sbin/ip)", nsjconf->iface, pid);
+       LOG_D("Putting iface:'%s' into namespace of PID:%d (with /sbin/ip)", nsjconf->iface_vs,
+             pid);
 
        char pid_str[256];
        snprintf(pid_str, sizeof(pid_str), "%d", pid);
 
        const char *argv[] =
-           { "/sbin/ip", "link", "add", "link", (char *)nsjconf->iface, "name", IFACE_NAME,
+           { "/sbin/ip", "link", "add", "link", (char *)nsjconf->iface_vs, "name", IFACE_NAME,
                "netns",
                pid_str, "type", "macvlan", "mode", "bridge", NULL
        };
        if (subprocSystem(argv, environ) != 0) {
-               LOG_E("Couldn't create MACVTAP interface for '%s'", nsjconf->iface);
+               LOG_E("Couldn't create MACVTAP interface for '%s'", nsjconf->iface_vs);
                return false;
        }
 
@@ -420,7 +421,7 @@ bool netInitNsFromChild(struct nsjconf_t * nsjconf)
                        return false;
                }
        }
-       if (nsjconf->iface) {
+       if (nsjconf->iface_vs) {
                if (netConfigureVs(nsjconf) == false) {
                        return false;
                }