From: Ian Kelling Date: Tue, 20 Oct 2020 19:49:27 +0000 (-0400) Subject: minor improvement X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=8e4cd767defea2b4bc5466978643e6f1bbaf7578;p=newns minor improvement --- diff --git a/newns b/newns index 26874a1..a3a9325 100755 --- a/newns +++ b/newns @@ -143,7 +143,6 @@ if $install_error; then fi #### end sanity checking #### - 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 + +mkdir -p /run/netns 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 -sf /proc/1/ns/net $target fi - ipd() { ip -n default "$@"; }