aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifdown2
-rwxr-xr-xsysconfig/network-scripts/ifup16
-rw-r--r--sysconfig/network-scripts/network-functions19
3 files changed, 22 insertions, 15 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index a1a7c27a..3ccf4547 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -52,6 +52,8 @@ if [ "${NETWORKING_IPV6}" = "yes" ]; then
/etc/sysconfig/network-scripts/ifdown-ipv6 ${CONFIG}
fi
+expand_config
+
retcode=0
if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
[ -n "`pidof -x dhcpcd`" ] && {
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index fa155f71..2f61aca1 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -181,21 +181,7 @@ else
exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}
fi
- if [ -z "${NETMASK}" ]; then
- eval `/bin/ipcalc --netmask ${IPADDR}`
- fi
-
- if [ -z "${PREFIX}" ]; then
- eval `/bin/ipcalc --prefix ${IPADDR} ${NETMASK}`
- fi
-
- if [ -z "${BROADCAST}" ]; then
- eval `/bin/ipcalc --broadcast ${IPADDR} ${NETMASK}`
- fi
-
- if [ -z "${NETWORK}" ]; then
- eval `/bin/ipcalc --network ${IPADDR} ${NETMASK}`
- fi
+ expand_config
[ -n "${ARP}${PROMISC}${ALLMULTI}" ] && \
ip link set ${DEVICE} $(toggle_value arp $ARP) \
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 3ce52335..ae661a31 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -29,6 +29,25 @@ source_config ()
. $CONFIG
}
+expand_config ()
+{
+ if [ -z "${NETMASK}" ]; then
+ eval `/bin/ipcalc --netmask ${IPADDR}`
+ fi
+
+ if [ -z "${PREFIX}" ]; then
+ eval `/bin/ipcalc --prefix ${IPADDR} ${NETMASK}`
+ fi
+
+ if [ -z "${BROADCAST}" ]; then
+ eval `/bin/ipcalc --broadcast ${IPADDR} ${NETMASK}`
+ fi
+
+ if [ -z "${NETWORK}" ]; then
+ eval `/bin/ipcalc --network ${IPADDR} ${NETMASK}`
+ fi
+}
+
toggle_value()
{
if [ -z "$2" ]