From 2c1ff531e3547a74edb2718c7993575824b82c2a Mon Sep 17 00:00:00 2001 From: Robert Swiecki Date: Thu, 3 Mar 2016 15:43:40 +0100 Subject: [PATCH] Clearer naming of net functions --- contain.c | 4 +--- net.c | 6 +++--- net.h | 4 ++-- subproc.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/contain.c b/contain.c index 4899421..e4c36b6 100644 --- a/contain.c +++ b/contain.c @@ -34,12 +34,10 @@ #include #include #include -#include #include #include #include #include -#include #include #include #include @@ -51,7 +49,7 @@ bool containInitNetNs(struct nsjconf_t * nsjconf) { - return netInitNs(nsjconf); + return netInitNsFromChild(nsjconf); } static bool containSetGroups(pid_t pid) diff --git a/net.c b/net.c index 5aa0b50..a64051a 100644 --- a/net.c +++ b/net.c @@ -48,7 +48,7 @@ #if defined(NSJAIL_NL3_WITH_MACVLAN) #include #include -bool netCloneMacVtapAndNS(struct nsjconf_t * nsjconf, int pid) +bool netInitNsFromParent(struct nsjconf_t * nsjconf, int pid) { if (nsjconf->iface == NULL) { return true; @@ -145,7 +145,7 @@ static bool netSystemSbinIp(struct nsjconf_t *nsjconf, char *const *argv) } } -bool netCloneMacVtapAndNS(struct nsjconf_t *nsjconf, int pid) +bool netInitNsFromParent(struct nsjconf_t *nsjconf, int pid) { if (nsjconf->iface == NULL) { return true; @@ -429,7 +429,7 @@ static bool netConfigureVs(struct nsjconf_t *nsjconf) return true; } -bool netInitNs(struct nsjconf_t * nsjconf) +bool netInitNsFromChild(struct nsjconf_t * nsjconf) { if (nsjconf->iface_no_lo == false) { if (netIfaceUp("lo") == false) { diff --git a/net.h b/net.h index 8f1975a..8b541aa 100644 --- a/net.h +++ b/net.h @@ -27,11 +27,11 @@ #include "common.h" -bool netCloneMacVtapAndNS(struct nsjconf_t *nsjconf, int pid); bool netLimitConns(struct nsjconf_t *nsjconf, int connsock); int netGetRecvSocket(const char *bindhost, int port); int netAcceptConn(int listenfd); void netConnToText(int fd, bool remote, char *buf, size_t s, struct sockaddr_in6 *addr_or_null); -bool netInitNs(struct nsjconf_t *nsjconf); +bool netInitNsFromParent(struct nsjconf_t *nsjconf, int pid); +bool netInitNsFromChild(struct nsjconf_t *nsjconf); #endif /* _NET_H */ diff --git a/subproc.c b/subproc.c index 100dc50..f6dfc92 100644 --- a/subproc.c +++ b/subproc.c @@ -211,7 +211,7 @@ void subprocKillAll(struct nsjconf_t *nsjconf) static bool subprocInitParent(struct nsjconf_t *nsjconf, pid_t pid, int pipefd) { - if (netCloneMacVtapAndNS(nsjconf, pid) == false) { + if (netInitNsFromParent(nsjconf, pid) == false) { LOG_E("Couldn't create and put MACVTAP interface into NS of PID '%d'", pid); return false; }