From 7fe87b41c724c709a94a037dc83246c4094d80c9 Mon Sep 17 00:00:00 2001 From: Wiktor Garbacz Date: Wed, 24 Oct 2018 10:31:14 +0200 Subject: [PATCH] code formatting --- config.proto | 2 +- net.cc | 17 +++++++++-------- nsjail.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/config.proto b/config.proto index 41e47b0..2f3695b 100644 --- a/config.proto +++ b/config.proto @@ -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 --- 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 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; } diff --git a/nsjail.h b/nsjail.h index 1f8efb9..f91b8fd 100644 --- 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;