aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions36
1 files changed, 26 insertions, 10 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 9645a379..3b5695f7 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -156,20 +156,36 @@ source_config ()
expand_config ()
{
- if [ -z "${NETMASK}" ]; then
- eval $(/bin/ipcalc --netmask ${IPADDR})
- fi
+ local i=0 val
+ for idx in '' {0..255} ; do
+ ipaddr[$i]=$(eval echo '$'IPADDR$idx)
+ if [ -z "${ipaddr[$i]}" ]; then
+ [ "$idx" ] && [ $idx -gt 2 ] && break
+ continue
+ fi
+ prefix[$i]=$(eval echo '$'PREFIX$idx)
+ netmask[$i]=$(eval echo '$'NETMASK$idx)
+ broadcast[$i]=$(eval echo '$'BROADCAST$idx)
- if [ -z "${PREFIX}" ]; then
- eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
- fi
+ if [ "${netmask[$i]}x" = "x" ]; then
+ val=$(/bin/ipcalc --netmask "${ipaddr[$i]}")
+ netmask[$i]=${val##NETMASK=}
+ fi
- if [ -z "${BROADCAST}" ]; then
- eval $(/bin/ipcalc --broadcast ${IPADDR} ${NETMASK})
- fi
+ if [ "${prefix[$i]}x" = "x" ]; then
+ val=$(/bin/ipcalc --prefix ${ipaddr[$i]} ${netmask[$i]})
+ prefix[$i]=${val##PREFIX=}
+ fi
+
+ if [ "${broadcast[$i]}x" = "x" ]; then
+ val=$(/bin/ipcalc --broadcast ${ipaddr[$i]} ${netmask[$i]})
+ broadcast[$i]=${val##BROADCAST=}
+ fi
+ i=$((i+1))
+ done
if [ -z "${NETWORK}" ]; then
- eval $(/bin/ipcalc --network ${IPADDR} ${NETMASK})
+ eval $(/bin/ipcalc --network ${ipaddr[0]} ${netmask[0]})
fi
}