[Ultrapossum-cvs 985] demo/uml 1.18, 1.19, map 1.12, 1.13, uml-run 1.24, 1.25, update-uml

Back to archive index

Masato Taruishi taru****@users*****
2004年 10月 25日 (月) 20:51:36 JST


===================================================================
RCS file: demo/uml/map,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- demo/uml/map	2004/10/23 02:24:39	1.18
+++ demo/uml/map	2004/10/25 11:51:36	1.19
@@ -93,8 +93,10 @@
 #bcast="$NETPREFIX.`expr $n + $WIDTH - 1`"
 bcast="$BCAST"
 netmask="$NETMASK"
-host="$NETPREFIX.`expr $n + 1`"
-uml="$NETPREFIX.`expr $n + 2`"
+#host="$NETPREFIX.`expr $n + 1`"
+#uml="$NETPREFIX.`expr $n + 2`"
+host="$NETPREFIX.254"
+uml="$NETPREFIX.`expr $n + 1`"
 nat="true"
 
 if test -f "$UML_CONFDIR/$arg/map.cf"; then
===================================================================
RCS file: demo/uml/uml-run,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- demo/uml/uml-run	2004/10/19 15:37:51	1.12
+++ demo/uml/uml-run	2004/10/25 11:51:36	1.13
@@ -31,26 +31,9 @@
   exit 1
 fi
 
-trap "
-  if test "x$pid" != "x"; then kill $pid; fi
-  eval `ultrapossum-config term`
-  tunctl -d $host_if
-  if test "x$nat" = "xtrue"; then
-    iptables -t nat -D POSTROUTING -s $net -d ! $net -j MASQUERADE
-  fi
-" 0
+trap "`ultrapossum-config term`" 0
 
-tunctl -u $UML_USER -t $host_if
-ifconfig $host_if $host broadcast $bcast netmask $netmask up
-route add -host $uml dev $host_if
-if test "x$nat" = "xtrue"; then
-  iptables -t nat -A POSTROUTING -s $net -d ! $net -j MASQUERADE
-else
-  echo 1 > "/proc/sys/net/ipv4/conf/$host_if/proxy_arp"
-  for if in `cat /proc/net/dev | grep eth | cut -d: -f1 | tr -d ' '`; do
-    arp -Ds $uml $if pub
-  done
-fi
+ifup $host_if || true
 echo 1 > /proc/sys/net/ipv4/ip_forward
 
 "$@"
===================================================================
RCS file: demo/uml/update-uml,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- demo/uml/update-uml	2004/10/20 08:33:36	1.24
+++ demo/uml/update-uml	2004/10/25 11:51:36	1.25
@@ -21,7 +21,8 @@
 
 eval `ultrapossum-config init`
 tmp=`tempfile`
-trap "/bin/rm -f $tmp; eval `ultrapossum-config term`" 0
+tmpint=`tempfile`
+trap "/bin/rm -f $tmp $tmp2; eval `ultrapossum-config term`" 0
 
 id="UML"
 
@@ -30,6 +31,7 @@
   install -d $UMLDIR
   /bin/cp /dev/null $UMLDIR/hosts
   add_startmark "##" "$id" > $tmp
+  add_startmark "##" "$id" > $tmpint
   for h in $UML_HOSTS
   do
     install -d $UMLDIR/$h
@@ -41,6 +43,26 @@
     source_shell "$UMLDIR/$h/map"
     $MODULEDIR/uml/rootstrap.sh $h > $UMLDIR/$h/rootstrap.conf
 
+    # interfaces handling
+    cat >> $tmpint <<EOF
+
+auto $host_if
+iface $host_if inet static
+	address $host
+	netmask $netmask
+	broadcast $bcast
+	pre-up tunctl -u $UML_USER -t $host_if || true
+	up route add -host $uml $host_if
+	post-down tunctl -d $host_if || true
+EOF
+    if test "x$nat" = "xtrue"; then
+      echo "	up iptables -t nat -A POSTROUTING -s $net -d ! $net -j MASQUERADE" >> $tmpint
+      echo "	down iptables -t nat -D POSTROUTING -s $net -d ! $net -j MASQUERADE" >> $tmpint
+    else
+      echo "	up echo 1 > /proc/sys/net/ipv4/conf/$host_if/proxy_arp" >> $tmpint
+      echo "	up for if in \`cat /proc/net/dev | grep eth | cut -d: -f1 | tr -d ' '\`; do arp -Ds $uml \$if pub; done" >> $tmpint
+    fi
+
     # handling uml host name resolving
     if test "x$local_net" != "x"; then
       echo "$local_net $h" >> $UMLDIR/hosts
@@ -66,7 +88,9 @@
   done
 
   add_endmark "##" "$id" >> $tmp
+  add_endmark "##" "$id" >> $tmpint
   add_end_vaconf "/etc/hosts" "$tmp" "$id"
+  add_end_vaconf "/etc/network/interfaces" "$tmpint" "$id"
 
   for h in $MASTER $SLAVES
   do 
@@ -89,16 +113,16 @@
 
 # ad-hoc?
 adjustconfig() {
-  ultrapossum_setconf_shell "$UMLDIR/etc/ultrapossum.cf" LDAPMASTER "$HOST"
+  ultrapossum_setconf_shell "$UMLDIR/etc/ultrapossum.cf" LDAPMASTER "$LDAPMASTER"
   if test -f "$UMLDIR/etc/server.cf"; then
-    ultrapossum_setconf_shell "$UMLDIR/etc/module.d/server.cf" MASTER "$HOST"
+    ultrapossum_setconf_shell "$UMLDIR/etc/module.d/server.cf" MASTER "$MASTER"
   fi
   if test -f "$UMLDIR/etc/module.d/failover.cf"; then
     ultrapossum_setconf_shell "$UMLDIR/etc/module.d/failover.cf" NFSDIR "$NFSDIR"
     ultrapossum_setconf_shell "$UMLDIR/etc/module.d/failover.cf" NFSDEVICE "$NFSDEVICE"
     ultrapossum_setconf_shell "$UMLDIR/etc/default.cf" "logfile" "/var/log/ha-log"
     ultrapossum_setconf_shell "$UMLDIR/etc/default.cf" "debugfile" "/var/log/ha-debug"
-    ultrapossum_setconf_shell "$UMLDIR/etc/default.cf" "ucast" "eth0 $MASTER"
+    ultrapossum_setconf_shell "$UMLDIR/etc/default.cf" "ucast" "eth0 `getip $MASTER`"
   fi
 }
 
@@ -106,7 +130,7 @@
 getip() {
   ip="`gethostip -d $1`"
   if test "$ip" = "127.0.0.1"; then
-    echo "$host"
+    echo "$1"
   elif test -n "$ip"; then
     echo "$ip"
   else



Ultrapossum-cvs メーリングリストの案内
Back to archive index