diff options
Diffstat (limited to 'rc.inet1')
-rw-r--r-- | rc.inet1 | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -193,18 +193,12 @@ if_up() { info_log "${1}: skipping - you might need to increase MAXNICS" return fi + info_log "${1}: configuring interface" # If the interface is a bridge, then create it first. # If you need to set hardware addresses for the underlying interfaces, # configure the interfaces with IPs of 0.0.0.0 and set the MAC address # in the usual way. Then, finally, define the bridge. [ -n "${BRNICS[$i]}" ] && br_open $i - # Skip unconfigured interfaces: - if [ -z "${IPADDR[$i]}" ] && [ "${USE_DHCP[$i]}" != "yes" ] && [ -z "${IP6ADDRS[$i]}" ] && \ - [ "${USE_DHCP6[$i]}" != "yes" ] && [ "${USE_SLAAC[$i]}" != "yes" ]; then - debug_log "${1}: skipping IP configuration - not configured in /etc/rc.d/rc.inet1.conf" - return - fi - info_log "${1}: configuring interface" if [ -e /sys/class/net/${1%%[:.]*} ]; then # interface exists 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 @@ -212,7 +206,7 @@ if_up() { # Handle VLAN interfaces before trying to configure IP addresses. if echo "${1}" | grep -Fq .; then iface="${1%.*}" - vlan="${1#*.}" + vlan="${1##*.}" # Check if the underlying interface is already up. if ! /sbin/ip link show dev ${iface} 2>/dev/null| grep -wq "state UP"; then # Bring up the underlying interface. @@ -465,6 +459,10 @@ if_down() { cat /proc/sys/net/ipv6/conf/default/autoconf >/proc/sys/net/ipv6/conf/$1/autoconf cat /proc/sys/net/ipv6/conf/default/accept_ra >/proc/sys/net/ipv6/conf/$1/accept_ra fi + # If the interface is a bridge, then destroy it now: + if [ -n "${BRNICS[$i]}" ]; then + br_close $i + fi # Take down VLAN interface, if configured. if echo "${1}" | grep -Fq .; then info_log "${1}: destroying VLAN interface" @@ -475,10 +473,6 @@ if_down() { if [ -x /etc/rc.d/rc.wireless ]; then . /etc/rc.d/rc.wireless ${1} stop fi - # If the interface is a bridge, then destroy it now: - if [ -n "${BRNICS[$i]}" ]; then - br_close $i - fi fi } @@ -531,7 +525,7 @@ start() { # Function to stop the network: stop() { gateway_down - for (( i = $MAXNICS; i >= 0; i-- )); do + for (( i = $MAXNICS - 1; i >= 0; i-- )); do if_down ${IFNAME[$i]} done virtif_destroy |