X-Git-Url: https://git.pld-linux.org/?p=projects%2Frc-scripts.git;a=blobdiff_plain;f=lib%2Ffunctions;h=e32f2d087ec28458ad3427307b76f9c7af945705;hp=5956a97ca32d90723421649548ae5c8bd858a8b3;hb=61bf3b6f9f4bbcea2e1989529b6360778a4c1ce3;hpb=3a61868bfffe2714b8add52ef6bed3395e87bcf3 diff --git a/lib/functions b/lib/functions index 5956a97c..e32f2d08 100644 --- a/lib/functions +++ b/lib/functions @@ -93,16 +93,27 @@ if [ -z "$VSERVER_ISOLATION_NET" -o "$VSERVER_ISOLATION_NET" = "detect" ]; then VSERVER_ISOLATION_NET=no if [ "$VSERVER" = "yes" ]; then if [ -f /proc/self/nsproxy ]; then + # older kernels { while read _t _data; do [ "$_t" = "net:" ] && break done < /proc/self/nsproxy } 2> /dev/null + if [ "${_data##*\(}" = "I)" ]; then + VSERVER_ISOLATION_NET=yes + fi + elif [ -f /proc/self/ninfo ]; then + # newer kernels + { + while read _t _data; do + [ "$_t" = "NCaps:" ] && break + done < /proc/self/ninfo + } 2> /dev/null + if [ "${_t}" = "NCaps:" ]; then + VSERVER_ISOLATION_NET=yes + fi else - # assume old kernel mode - VSERVER_ISOLATION_NET=yes - fi - if [ "${_data##*\(}" = "I)" ]; then + # assume (very?) old kernel mode VSERVER_ISOLATION_NET=yes fi unset _f _data