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 /network-scripts/ifup-eth | |
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.
Diffstat (limited to 'network-scripts/ifup-eth')
-rwxr-xr-x | network-scripts/ifup-eth | 29 |
1 files changed, 16 insertions, 13 deletions
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%%=*}; |