Remove netmask from network_map
[tridge/autocluster.git] / autocluster
index 3e9d88e99782313244614645497b4f0942e0def3..0eb26f5076a603a723c60c5d69e4ef1260d109b9 100755 (executable)
@@ -350,15 +350,14 @@ make_network_map ()
        local net="${ip_bits%/*}"
        local netname="acnet_${net//./_}"
 
-       local ip="${net%.*}.${IPNUM}"
-       local mask="255.255.255.0"
+       local ip="${net%.*}.${IPNUM}/${ip_bits#*/}"
 
        # This can be used to override the variables in the echo
        # statement below.  The hook can use any other variables
        # available in this function.
        run_hooks hack_network_map_hooks
 
-       echo "${netname} ${dev} ${ip} ${mask} ${mac} ${opts}"
+       echo "${netname} ${dev} ${ip} ${mac} ${opts}"
        count=$(($count + 1))
     done >"$network_map"
 }
@@ -719,8 +718,8 @@ guess_install_network ()
     # specified then use the IP address associated with it.
     INSTALL_IP=""
     INSTALL_GW=""
-    local netname dev ip mask mac opts
-    while read netname dev ip mask mac opts; do
+    local netname dev ip mac opts
+    while read netname dev ip mac opts; do
        local o
        for o in $opts ; do
            case "$o" in
@@ -1008,11 +1007,11 @@ setup_network()
     diskimage rm_rf "/etc/udev/rules.d/70-persistent-net.rules"
 
     echo "Setting up network interfaces: "
-    local netname dev ip mask mac opts
-    while read netname dev ip mask mac opts; do
+    local netname dev ip mac opts
+    while read netname dev ip mac opts; do
        echo "  $dev"
 
-       local o gw
+       local o gw addr mask
        gw=""
        for o in $opts ; do
            case "$o" in
@@ -1021,12 +1020,15 @@ setup_network()
            esac
        done
 
+       addr=${ip%/*}
+       mask=$(ipv4_prefix_to_netmask ${ip#*/})
+
        cat <<EOF | \
            diskimage put - "/etc/sysconfig/network-scripts/ifcfg-${dev}"
 DEVICE=$dev
 ONBOOT=yes
 TYPE=Ethernet
-IPADDR=$ip
+IPADDR=$addr
 NETMASK=$mask
 HWADDR=$mac
 ${gw:+GATEWAY=}${gw}