Hi thomas,

see here:

        
http://svn.debian.org/wsvn/fai/people/faiguy/bugfixes/480531/bin/fai-setup?op=diff&rev=0&sc=1

for my suggestion for fixing the network problem.

br
Chris
Index: 480531/bin/fai-setup
===================================================================
--- 480531/bin/fai-setup	(.../trunk/bin/fai-setup)	(Revision 4893)
+++ 480531/bin/fai-setup	(.../people/faiguy/bugfixes/480531/bin/fai-setup)	(Revision 4894)
@@ -143,7 +143,51 @@
     set -e
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+compute_network() {
 
+	# this dark magic calculates the network from a given ipaddress and netmask
+
+	inputAddr=$1
+	inputMask=$2
+
+	fsnm="${inputMask%.*}"
+	lsnm="${inputMask##*.}"
+	foct="${inputAddr%.*}"
+	loct="${inputAddr##*.}"
+	nwz=""
+	if [ "$lsnm" = "0" ]; then
+		nwz=".0"
+		lsnm="${fsnm##*.}"
+		fsnm="${fsnm%.*}"
+		loct="${foct##*.}"
+		foct="${foct%.*}"
+		if [ "$lsnm" = "0" ]; then
+			nwz=".0$nwz"
+			lsnm="${fsnm##*.}"
+			fsnm="${fsnm%.*}"
+			loct="${foct##*.}"
+			foct="${foct%.*}"
+			if [ "$lsnm" = "0" ]; then
+				nwz=".0$nwz"
+				lsnm=$fsnm
+				loct=$foct
+				foct=""
+			fi
+		fi
+	fi
+	let snb=256-$lsnm
+	let loct=$loct/$snb*$snb
+	if [ "$foct" ]; then
+		tnw="$foct.$loct$nwz"
+	else
+		tnw="$loct$nwz"
+	fi
+	echo $tnw
+}
+
+# compute_network $addr $mask
+
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 { # start huge block for capturing output
 
 if [ -n "$LOGUSER" ]; then
@@ -178,6 +222,7 @@
 
     addr=$(LC_ALL=C ifconfig $SERVERINTERFACE | grep -v 127.0.0.1 | perl -ne '/addr:([\d.]+)/ && print"$1\n"'|head -1)
     mask=$(LC_ALL=C ifconfig $SERVERINTERFACE | grep -v 127.0.0.1 | perl -ne '/Mask:([\d.]+)/ && print"$1\n"'|head -1)
+	addr=$(compute_network $addr $mask)
     add_export_line $FAI_CONFIGDIR  "$addr/$mask(async,ro,no_subtree_check)"
     add_export_line $NFSROOT  "$addr/$mask(async,ro,no_subtree_check,no_root_squash)"
     if [ -z "$nfsserver" ]; then

Reply via email to