diff options
author | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2019-11-12 19:55:21 +0000 |
---|---|---|
committer | Darren 'Tadgy' Austin <darren@afterdark.org.uk> | 2019-11-12 19:55:21 +0000 |
commit | 9383f916300851f71f74936ab7e193b63857cea8 (patch) | |
tree | 6786a64925da8d02baed176c4fc24ce69e461536 /rc.inet1 | |
parent | b45bac6044a3e39ea591bdb9c32ae6d7b2ec86cf (diff) | |
download | slacknetsetup-9383f916300851f71f74936ab7e193b63857cea8.tar.xz |
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.
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 |