make indent depend

This commit is contained in:
Robert Swiecki 2018-02-11 04:02:43 +01:00
parent ac89fbb44f
commit 7b9178f5d7
5 changed files with 18 additions and 14 deletions

View File

@ -125,7 +125,8 @@ static bool initNsFromParentNetCls(nsjconf_t* nsjconf, pid_t pid) {
char net_cls_cgroup_path[PATH_MAX]; char net_cls_cgroup_path[PATH_MAX];
snprintf(net_cls_cgroup_path, sizeof(net_cls_cgroup_path), "%s/%s/NSJAIL.%d", snprintf(net_cls_cgroup_path, sizeof(net_cls_cgroup_path), "%s/%s/NSJAIL.%d",
nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(), (int)pid); nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(),
(int)pid);
LOG_D("Create '%s' for PID=%d", net_cls_cgroup_path, (int)pid); LOG_D("Create '%s' for PID=%d", net_cls_cgroup_path, (int)pid);
if (mkdir(net_cls_cgroup_path, 0700) == -1 && errno != EEXIST) { if (mkdir(net_cls_cgroup_path, 0700) == -1 && errno != EEXIST) {
PLOG_E("mkdir('%s', 0700) failed", net_cls_cgroup_path); PLOG_E("mkdir('%s', 0700) failed", net_cls_cgroup_path);
@ -267,7 +268,8 @@ void finishFromParentNetCls(nsjconf_t* nsjconf, pid_t pid) {
} }
char net_cls_cgroup_path[PATH_MAX]; char net_cls_cgroup_path[PATH_MAX];
snprintf(net_cls_cgroup_path, sizeof(net_cls_cgroup_path), "%s/%s/NSJAIL.%d", snprintf(net_cls_cgroup_path, sizeof(net_cls_cgroup_path), "%s/%s/NSJAIL.%d",
nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(), (int)pid); nsjconf->cgroup_net_cls_mount.c_str(), nsjconf->cgroup_net_cls_parent.c_str(),
(int)pid);
LOG_D("Remove '%s'", net_cls_cgroup_path); LOG_D("Remove '%s'", net_cls_cgroup_path);
if (rmdir(net_cls_cgroup_path) == -1) { if (rmdir(net_cls_cgroup_path) == -1) {
PLOG_W("rmdir('%s') failed", net_cls_cgroup_path); PLOG_W("rmdir('%s') failed", net_cls_cgroup_path);

4
net.cc
View File

@ -135,7 +135,9 @@ bool initNsFromParent(nsjconf_t* nsjconf, int pid) {
char pid_str[256]; char pid_str[256];
snprintf(pid_str, sizeof(pid_str), "%d", pid); snprintf(pid_str, sizeof(pid_str), "%d", pid);
const std::vector<std::string> argv {"/sbin/ip", "link", "add", "link", (char*)nsjconf->iface_vs.c_str(), "name", IFACE_NAME, "netns", pid_str, "type", "macvlan", "mode", "bridge" }; const std::vector<std::string> argv{"/sbin/ip", "link", "add", "link",
(char*)nsjconf->iface_vs.c_str(), "name", IFACE_NAME, "netns", pid_str, "type",
"macvlan", "mode", "bridge"};
if (subproc::systemExe(argv, environ) != 0) { if (subproc::systemExe(argv, environ) != 0) {
LOG_E("Couldn't create MACVTAP interface for '%s'", nsjconf->iface_vs.c_str()); LOG_E("Couldn't create MACVTAP interface for '%s'", nsjconf->iface_vs.c_str());
return false; return false;