Trellis branch to support network namespaces
[util-vserver-pl.git] / src / vsh.c
index ffbe027..9a23505 100644 (file)
--- a/src/vsh.c
+++ b/src/vsh.c
@@ -113,6 +113,8 @@ static int sandbox_processes(xid_t ctx, const char *context, const struct passwd
        int  ctx_is_new;
        struct sliver_resources slr;
        char hostname[HOST_NAME_MAX+1];
+       int unshare_netns;
+
        pl_get_limits(context,&slr);
 
        if (gethostname(hostname, sizeof hostname) == -1)
@@ -127,10 +129,13 @@ static int sandbox_processes(xid_t ctx, const char *context, const struct passwd
            fprintf(stderr, "*** %s: %s has zero cpu resources and presumably it has been disabled/suspended ***\n", hostname, context);
            exit(0);
          }
+       
+       unshare_netns = pl_unshare_netns(ctx);
 
        (void) (sandbox_chroot(pwd));
 
-        if ((ctx_is_new = pl_chcontext(ctx, ~vc_get_insecurebcaps(),&slr)) < 0)
+        if ((ctx_is_new = pl_chcontext(ctx, ~vc_get_insecurebcaps(),&slr, 
+                                      unshare_netns)) < 0)
           {
             PERROR("pl_chcontext(%u)", ctx);
             exit(1);