iankelling.org
/
git
/
newns
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor improvement
[newns]
/
newns
diff --git
a/newns
b/newns
index 26874a14949742fd449609038ec4059dc8423081..a3a932511a5b326967208bcd8f8f3b707d7beb0e 100755
(executable)
--- a/
newns
+++ b/
newns
@@
-143,7
+143,6
@@
if $install_error; then
fi
#### end sanity checking ####
fi
#### end sanity checking ####
-
v0=veth0-$nn
v1=veth1-$nn
ip_base=10.173
v0=veth0-$nn
v1=veth1-$nn
ip_base=10.173
@@
-153,13
+152,14
@@
if ! $create && [[ $(readlink /proc/self/ns/net) == "$(readlink /proc/1/ns/net)"
fi
# make the default network namespace be named
fi
# make the default network namespace be named
+
+mkdir -p /run/netns
target=/run/netns/default
if [[ ! -e $target && ! -L $target ]]; then
target=/run/netns/default
if [[ ! -e $target && ! -L $target ]]; then
- mkdir -p /run/netns
- ln -s /proc/1/ns/net $target
+ # -f to avoid a race condition with running twice
+ ln -s
f
/proc/1/ns/net $target
fi
fi
-
ipd() { ip -n default "$@"; }
ipd() { ip -n default "$@"; }