summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rc.inet144
1 files changed, 23 insertions, 21 deletions
diff --git a/rc.inet1 b/rc.inet1
index e12dfbf..165672c 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -250,27 +250,29 @@ if_up() {
debug_log "${1} interface is not configured in /etc/rc.d/rc.inet1.conf"
return
fi
- # Add extra IPv4 and v6 addresses, if defined, to the interface:
- if [ -n "${IPALIASES[$i]}" ]; then
- num=0
- for ipalias in ${IPALIASES[$i]}; do
- ip="${ipalias%/*}"
- nm="${ipalias#*/}"
- [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="24"
- echo "/etc/rc.d/rc.inet1: /sbin/ip -4 address add ${ip}/${nm} dev ${1} label ${1}:${num}" | $LOGGER
- /sbin/ip -4 address add ${ip}/${nm} dev ${1} label ${1}:${num}
- num=$(($num + 1))
- done
- fi
- if [ -n "${IPALIASES6[$i]}" ]; then
- for ipalias in ${IPALIASES6[$i]}; do
- ip="${ipalias%/*}"
- nm="${ipalias#*/}"
- [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="64"
- # Unluke IPv4, v6 addresses don't get a label:
- echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${ip}/${nm} dev ${1}" | $LOGGER
- /sbin/ip -6 address add ${ip}/${nm} dev ${1}
- done
+ # Add extra IPv4 and v6 addresses, if defined, to the interface only if it came up:
+ if (($IF_UP == 1)); then
+ if [ -n "${IPALIASES[$i]}" ]; then
+ num=0
+ for ipalias in ${IPALIASES[$i]}; do
+ ip="${ipalias%/*}"
+ nm="${ipalias#*/}"
+ [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="24"
+ echo "/etc/rc.d/rc.inet1: /sbin/ip -4 address add ${ip}/${nm} dev ${1} label ${1}:${num}" | $LOGGER
+ /sbin/ip -4 address add ${ip}/${nm} dev ${1} label ${1}:${num}
+ num=$(($num + 1))
+ done
+ fi
+ if [ -n "${IPALIASES6[$i]}" ]; then
+ for ipalias in ${IPALIASES6[$i]}; do
+ ip="${ipalias%/*}"
+ nm="${ipalias#*/}"
+ [ -z "$nm" ] || [ "$ip" == "$nm" ] && nm="64"
+ # Unlike IPv4, v6 addresses don't get a label:
+ echo "/etc/rc.d/rc.inet1: /sbin/ip -6 address add ${ip}/${nm} dev ${1}" | $LOGGER
+ /sbin/ip -6 address add ${ip}/${nm} dev ${1}
+ done
+ fi
fi
# Force an MTU (possibly over-riding that set by DHCP):
if [ -n "${MTU[$i]}" ]; then