[projects/rc-scripts] Add additional vs isolation net detection method using /proc/self/ninfo (available for example on 3.

arekm arekm at pld-linux.org
Thu Mar 20 19:14:03 CET 2014


commit 61bf3b6f9f4bbcea2e1989529b6360778a4c1ce3
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Mar 20 19:13:52 2014 +0100

    Add additional vs isolation net detection method using /proc/self/ninfo (available for example on 3.13 kernel).

 lib/functions | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/lib/functions b/lib/functions
index 5956a97..e32f2d0 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
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/61bf3b6f9f4bbcea2e1989529b6360778a4c1ce3



More information about the pld-cvs-commit mailing list