summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackware.com>2017-01-07 19:56:50 -0600
committerRobby Workman <rworkman@slackware.com>2017-07-11 16:58:52 -0500
commitbe16cd097aceae6dd31428dbf1b601d22c92ecaf (patch)
treef0744f2fc4bc8cf0c2274bfde03d404191f7c57b
parente392f00ff431347d3b8a367ccbffc75ab33cd9d2 (diff)
downloadslacknetsetup-be16cd097aceae6dd31428dbf1b601d22c92ecaf.tar.xz
rc.inet1: Migrate bridge setup/teardown to iproute2 from brctl
This should complete f7533fca7e82 and eliminate the TODO
-rw-r--r--rc.inet117
1 files changed, 13 insertions, 4 deletions
diff --git a/rc.inet1 b/rc.inet1
index cd18729..ded37f5 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -76,24 +76,27 @@ lo_down() {
# Function to assemble a bridge interface.
br_open() {
# argument is 'i' - the position of this interface in the IFNAME array.
- /sbin/brctl addbr ${IFNAME[$1]}
+ /sbin/ip link add name ${IFNAME[$1]} type bridge
for BRIF in $(echo ${BRNICS[$1]}); do
/sbin/ip link set $BRIF down
/sbin/ip address add 0.0.0.0 dev $BRIF
- /sbin/brctl addif ${IFNAME[$1]} $BRIF
+ /sbin/ip link set dev $BRIF master ${IFNAME[$1]}
+ /sbin/ip link set $BRIF up
done
+ /sbin/ip link set ${IFNAME[$1]} up
}
# Function to disassemble a bridge interface.
br_close() {
+ /sbin/ip link set ${IFNAME[$1]} down
# argument is 'i' - the position of this interface in the IFNAME array.
#for BRIF in $(echo ${BRNICS[$1]}); do
for BRIF in $(ls --indicator-style=none /sys/class/net/${IFNAME[$1]}/brif/)
do
- /sbin/brctl delif ${IFNAME[$1]} $BRIF
+ /sbin/ip link set dev $BRIF nomaster
done
/sbin/ip link set ${IFNAME[$1]} down
- /sbin/brctl delbr ${IFNAME[$1]}
+ /sbin/ip link del name ${IFNAME[$1]} type bridge
}
# Function to bring up a network interface. If the interface is
@@ -133,6 +136,9 @@ if_up() {
echo "/etc/rc.d/rc.inet1: /sbin/ip link set dev ${1} mtu ${MTU[$i]}" | $LOGGER
/sbin/ip link set dev ${1} mtu ${MTU[$i]}
fi
+ if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then
+ /sbin/ip link set dev ${1} up # Bring up interface
+ fi
if [ -x /etc/rc.d/rc.wireless ]; then
. /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters
fi
@@ -177,6 +183,9 @@ if_up() {
# Set up the network card:
echo "/etc/rc.d/rc.inet1: /sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}" | $LOGGER
/sbin/ip address add ${IPADDR[$i]}/${NETMASK[$i]} dev ${1}
+ if /sbin/ip link show dev ${1} | grep -wq "state DOWN" ; then
+ /sbin/ip link set dev ${1} up # Bring up interface
+ fi
else
if [ "$DEBUG_ETH_UP" = "yes" ]; then
echo "/etc/rc.d/rc.inet1: ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER