code formatting
authorWiktor Garbacz <wiktorg@google.com>
Wed, 24 Oct 2018 08:31:14 +0000 (10:31 +0200)
committerWiktor Garbacz <wiktorg@google.com>
Wed, 24 Oct 2018 08:31:14 +0000 (10:31 +0200)
config.proto
net.cc
nsjail.h

index 41e47b0..2f3695b 100644 (file)
@@ -192,7 +192,7 @@ message NsJailConfig {
        Homepage of the project: https://github.com/google/kafel */
     optional string seccomp_policy_file = 57;
     repeated string seccomp_string = 58;
-    /* Setting it to true makes audit write seccomp logs to dmesg */ 
+    /* Setting it to true makes audit write seccomp logs to dmesg */
     optional bool seccomp_log = 77 [default = false];
 
     /* If > 0, maximum cumulative size of RAM used inside any jail */
diff --git a/net.cc b/net.cc
index d22f047..f64d304 100644 (file)
--- a/net.cc
+++ b/net.cc
@@ -188,17 +188,18 @@ bool initNsFromParent(nsjconf_t* nsjconf, int pid) {
            nsjconf->iface_vs.c_str(), pid);
 
        std::vector<std::string> argv;
-       
-       if ( nsjconf->iface_vs_ma != "" ) {
-         argv = {"/sbin/ip", "link", "add", "link", nsjconf->iface_vs,
-             "name", IFACE_NAME, "netns", std::to_string(pid), "address", nsjconf->iface_vs_ma, "type", "macvlan", "mode", "bridge"};
+
+       if (nsjconf->iface_vs_ma != "") {
+               argv = {"/sbin/ip", "link", "add", "link", nsjconf->iface_vs, "name", IFACE_NAME,
+                   "netns", std::to_string(pid), "address", nsjconf->iface_vs_ma, "type",
+                   "macvlan", "mode", "bridge"};
        } else {
-         argv = {"/sbin/ip", "link", "add", "link", nsjconf->iface_vs,
-             "name", IFACE_NAME, "netns", std::to_string(pid), "type", "macvlan", "mode", "bridge"};
+               argv = {"/sbin/ip", "link", "add", "link", nsjconf->iface_vs, "name", IFACE_NAME,
+                   "netns", std::to_string(pid), "type", "macvlan", "mode", "bridge"};
        }
        if (subproc::systemExe(argv, environ) != 0) {
-         LOG_E("Couldn't create MACVTAP interface for '%s'", nsjconf->iface_vs.c_str());
-         return false;
+               LOG_E("Couldn't create MACVTAP interface for '%s'", nsjconf->iface_vs.c_str());
+               return false;
        }
        return true;
 }
index 1f8efb9..f91b8fd 100644 (file)
--- a/nsjail.h
+++ b/nsjail.h
@@ -125,7 +125,7 @@ struct nsjconf_t {
        std::string iface_vs_ip;
        std::string iface_vs_nm;
        std::string iface_vs_gw;
-       std::string iface_vs_ma;  
+       std::string iface_vs_ma;
        std::string cgroup_mem_mount;
        std::string cgroup_mem_parent;
        size_t cgroup_mem_max;