Initial commit - first development version of Mininet

This commit is contained in:
Bob Lantz
2009-12-08 18:08:03 -08:00
commit 98d4f1891c
3 changed files with 661 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
/* netns: run a command in a network namespace.
* Simplified from netunshare.c on lxc.sf.net
*/
#include <stdio.h>
#include <sched.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
if (unshare(CLONE_NEWNET) == -1) {
perror("unshare");
return 1;
}
if (argc) {
execve(argv[1], &argv[1], __environ);
perror("execve");
return 1;
}
return 0;
}