summaryrefslogtreecommitdiffstats
path: root/rc.inet1
diff options
context:
space:
mode:
Diffstat (limited to 'rc.inet1')
-rw-r--r--rc.inet132
1 files changed, 24 insertions, 8 deletions
diff --git a/rc.inet1 b/rc.inet1
index 34daef1..55ac726 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -107,7 +107,9 @@ lo_up() {
lo_down() {
if [ -e /sys/class/net/lo ]; then
info_log "lo: de-configuring interface"
+ debug_log "/sbin/ip address flush dev lo"
/sbin/ip address flush dev lo
+ debug_log "/sbin/ip link set dev lo down"
/sbin/ip link set dev lo down
fi
}
@@ -173,8 +175,10 @@ br_close() {
debug_log "/sbin/ip link set dev $BRIF nomaster"
/sbin/ip link set dev $BRIF nomaster
done
- debug_log "/sbin/ip link set dev ${IFNAME[$1]} down"
- /sbin/ip link set dev ${IFNAME[$1]} down
+ for BRIF in ${BRNICS[$1]}; do
+ debug_log "/sbin/ip link set dev $BRIF down"
+ /sbin/ip link set dev $BRIF down
+ done
debug_log "/sbin/ip link del ${IFNAME[$1]}"
/sbin/ip link del ${IFNAME[$1]}
}
@@ -188,8 +192,6 @@ bond_create() {
debug_log "/sbin/ip link set dev ${IFNAME[$1]} type bond mode ${BONDMODE[$1]}"
/sbin/ip link set dev ${IFNAME[$1]} type bond mode ${BONDMODE[$1]}
for BONDIF in ${BONDNICS[$1]}; do
- debug_log "/sbin/ip link set dev $BONDIF down"
- /sbin/ip link set dev $BONDIF down
debug_log "/sbin/ip address flush dev $BONDIF"
/sbin/ip address flush dev $BONDIF
debug_log "/sbin/ip link set $BONDIF master ${IFNAME[$1]}"
@@ -255,6 +257,10 @@ if_up() {
if ! /sbin/ip address show scope global dev ${1} 2>/dev/null | grep -Ewq '(inet|inet6)' || \
! /sbin/ip link show dev ${1} | grep -wq "state UP"; then # interface not up or not configured
local IF_UP=0
+ # Initialize any wireless parameters:
+ if [ -x /etc/rc.d/rc.wireless ]; then
+ . /etc/rc.d/rc.wireless ${1} start
+ fi
# Handle VLAN interfaces before trying to configure IP addresses.
if echo "${1}" | grep -Fq .; then
IFACE="${1%.*}"
@@ -300,10 +306,6 @@ if_up() {
info_log "${1}: failed to set hardware address"
fi
fi
- # Initialize any wireless parameters:
- if [ -x /etc/rc.d/rc.wireless ]; then
- . /etc/rc.d/rc.wireless ${1} start
- fi
if [ -e /proc/sys/net/ipv6 ]; then # ipv6 networking is available
# Disable v6 IP auto configuration before trying to bring up the interface:
debug_log "${1}: disabling IPv6 autoconf"
@@ -356,7 +358,9 @@ if_up() {
IF_UP=1
else
info_log "${1}: failed to obtain DHCP lease"
+ debug_log "/sbin/ip address flush dev ${1}"
/sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
/sbin/ip link set dev ${1} down
fi
fi
@@ -383,7 +387,9 @@ if_up() {
if (($IF_UP != 1)); then
echo "${1}: timed out"
info_log "${1}: failed to auto configure after ${SLAAC_TIMEOUT[$i]} seconds"
+ debug_log "/sbin/ip address flush dev ${1}"
/sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
/sbin/ip link set dev ${1} down
fi
fi
@@ -399,7 +405,9 @@ if_up() {
IF_UP=1
else
info_log "${1}: failed to set IP ${IPADDR[$i]}"
+ debug_log "/sbin/ip address flush dev ${1}"
/sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
/sbin/ip link set dev ${1} down
fi
fi
@@ -431,7 +439,9 @@ if_up() {
else
info_log "${1}: failed to set IP $IP"
if (($IF_UP != 1)); then # a v4 address was configured, don't flush it
+ debug_log "/sbin/ip address flush dev ${1}"
/sbin/ip address flush dev ${1}
+ debug_log "/sbin/ip link set dev ${1} down"
/sbin/ip link set dev ${1} down
fi
fi
@@ -536,8 +546,14 @@ if_down() {
# Take down VLAN interface, if configured.
if echo "${1}" | grep -Fq .; then
info_log "${1}: destroying VLAN interface"
+ debug_log "/sbin/ip link set dev ${1} down"
+ /sbin/ip link set dev ${1} down
debug_log "/sbin/ip link delete ${1}"
/sbin/ip link delete ${1}
+ if ! /sbin/ip address show scope global dev ${1%.*} 2>/dev/null | grep -Ewq '(inet|inet6)'; then
+ debug_log "/sbin/ip link set dev ${1%.*} down"
+ /sbin/ip link set dev ${1%.*} down
+ fi
fi
# Kill wireless daemons if any:
if [ -x /etc/rc.d/rc.wireless ]; then