From 9383f916300851f71f74936ab7e193b63857cea8 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Tue, 12 Nov 2019 19:55:21 +0000 Subject: Small fixes - see full log. Remove code to skip interfaces that do not have IP addresses configured. This checking is redundant now, and prevents interfaces being brought up without IP addresses - which is important for bridging/bonding/VLANs. When grabbing the vlan ID from the interface name, use ## instead of #. Move the point where bridges are taken down to before the point where wireless interfaces are taken down. This is required so that a bridge on a wireless interface is take down before the interface itself. When looping through the interfaces to take down, use MAXNICS-1. --- rc.inet1 | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'rc.inet1') diff --git a/rc.inet1 b/rc.inet1 index ffa3ae2..d8cbdfd 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -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 -- cgit v1.2.3