diff options
author | Phil Sutter <psutter@redhat.com> | 2018-06-11 16:58:20 +0200 |
---|---|---|
committer | Dee'Kej <deekej@linuxmail.org> | 2018-06-14 16:27:36 +0200 |
commit | bf40c2768d6b6614cc0f1b4fb68ca011489e89d3 (patch) | |
tree | aba0b4d44287db12c0cdcdfa1da5eff3568e15f1 | |
parent | 5a1369c0d0d589a948f05cf3f623f77cb42c28ea (diff) | |
download | initscripts-bf40c2768d6b6614cc0f1b4fb68ca011489e89d3.tar initscripts-bf40c2768d6b6614cc0f1b4fb68ca011489e89d3.tar.gz initscripts-bf40c2768d6b6614cc0f1b4fb68ca011489e89d3.tar.bz2 initscripts-bf40c2768d6b6614cc0f1b4fb68ca011489e89d3.tar.xz initscripts-bf40c2768d6b6614cc0f1b4fb68ca011489e89d3.zip |
network-scripts: Replace brctl with ip-link
Since ip-link has full support for Linux bridges (and slave ports), use
that instead of the deprecated brctl from bridge-utils.
-rwxr-xr-x | network-scripts/ifdown-eth | 7 | ||||
-rwxr-xr-x | network-scripts/ifup-eth | 29 |
2 files changed, 19 insertions, 17 deletions
diff --git a/network-scripts/ifdown-eth b/network-scripts/ifdown-eth index 97b17aaf..c610fd20 100755 --- a/network-scripts/ifdown-eth +++ b/network-scripts/ifdown-eth @@ -135,14 +135,13 @@ if [ -d "/sys/class/net/${REALDEVICE}" ]; then fi [ "$retcode" = "0" ] && retcode=$? -if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then - /sbin/ip link set dev ${DEVICE} down - /usr/sbin/brctl delif -- ${BRIDGE} ${DEVICE} +if [ -n "${BRIDGE}" ]; then + ip link set dev ${DEVICE} nomaster down # Upon removing a device from a bridge, # it's necessary to make radvd reload its config [ -r /run/radvd/radvd.pid ] && kill -HUP $(cat /run/radvd/radvd.pid) if [ -d /sys/class/net/${BRIDGE}/brif ] && [ $(ls -1 /sys/class/net/${BRIDGE}/brif | wc -l) -eq 0 ]; then - /usr/sbin/brctl delbr -- ${BRIDGE} + ip link del ${BRIDGE} fi fi diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth index 932635d4..bbb17790 100755 --- a/network-scripts/ifup-eth +++ b/network-scripts/ifup-eth @@ -45,21 +45,24 @@ if [ -n "${HWADDR}" ]; then fi fi -# If the device is a bridge, create it with brctl, if available. +# If the device is a bridge, create it if [ "${TYPE}" = "Bridge" ]; then - if [ ! -x /usr/sbin/brctl ]; then - net_log $"Bridge support not available: brctl not found" - exit 1 + bridge_opts="" + [ -n "${DELAY}" ] && bridge_opts+="forward_delay ${DELAY} " + if is_true "${STP}"; then + bridge_opts+="stp_state 1 " + elif is_false "${STP}"; then + bridge_opts+="stp_state 0 " fi + [ -n "${PRIO}" ] && bridge_opts+="priority ${PRIO} " + [ -n "${AGEING}" ] && bridge_opts+="ageing_time ${AGEING} " if [ ! -d /sys/class/net/${DEVICE}/bridge ]; then - /usr/sbin/brctl addbr -- ${DEVICE} || exit 1 + ip link add ${DEVICE} type bridge $bridge_opts + elif [ -n "${OPTS}" ]; then + ip link set ${DEVICE} type bridge $bridge_opts fi - - [ -n "${DELAY}" ] && /usr/sbin/brctl setfd -- ${DEVICE} ${DELAY} - [ -n "${STP}" ] && /usr/sbin/brctl stp -- ${DEVICE} ${STP} - [ -n "${PRIO}" ] && /usr/sbin/brctl setbridgeprio ${DEVICE} ${PRIO} - [ -n "${AGEING}" ] && /usr/sbin/brctl setageing ${DEVICE} ${AGEING} + unset bridge_opts # add the bits to setup driver parameters here for arg in $BRIDGING_OPTS ; do @@ -173,15 +176,15 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then fi # If the device is part of a bridge, add the device to the bridge -if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then +if [ -n "${BRIDGE}" ]; then if [ ! -d /sys/class/net/${BRIDGE}/bridge ]; then - /usr/sbin/brctl addbr -- ${BRIDGE} 2>/dev/null + ip link add ${BRIDGE} type bridge 2>/dev/null fi /sbin/ip addr flush dev ${DEVICE} 2>/dev/null /sbin/ip link set dev ${DEVICE} up ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} - /usr/sbin/brctl addif -- ${BRIDGE} ${DEVICE} + ip link set ${DEVICE} master ${BRIDGE} # add the bits to setup driver parameters here for arg in $BRIDGING_OPTS ; do key=${arg%%=*}; |