diff options
author | Jan Macku <jamacku@redhat.com> | 2020-12-03 14:33:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 14:33:07 +0100 |
commit | 0ac0949b03cdfc2c06ba997e9b3b890a5ca17b1f (patch) | |
tree | a9244eff6f07459021449e22f33b8af96e23ca4d /network-scripts/ifup-eth | |
parent | ab9a243d079d4e2122e094ae89d02d5ee7a4b791 (diff) | |
download | initscripts-0ac0949b03cdfc2c06ba997e9b3b890a5ca17b1f.tar initscripts-0ac0949b03cdfc2c06ba997e9b3b890a5ca17b1f.tar.gz initscripts-0ac0949b03cdfc2c06ba997e9b3b890a5ca17b1f.tar.bz2 initscripts-0ac0949b03cdfc2c06ba997e9b3b890a5ca17b1f.tar.xz initscripts-0ac0949b03cdfc2c06ba997e9b3b890a5ca17b1f.zip |
network: add option to keep the link down
Some interfaces like Open vSwitch bridges using the userspace datapath,
needs the link to be kept down to avoid issues.
Add a LINKSTATUS=[down|up] ifcfg parameter to add this functionality.
If not specified, the link will default to up as before.
Patch provided by Matteo Croce <mcroce@redhat.com>
Diffstat (limited to 'network-scripts/ifup-eth')
-rwxr-xr-x | network-scripts/ifup-eth | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth index 995cba16..730e08fd 100755 --- a/network-scripts/ifup-eth +++ b/network-scripts/ifup-eth @@ -76,7 +76,7 @@ if [ "${TYPE}" = "Bridge" ]; then # set LINKDELAY (used as timeout when calling check_link_down()) # to at least (${DELAY} * 2) + 7 if STP is enabled. This is the # minimum time required for /sys/class/net/$REALDEVICE/carrier to - # become 1 after "ip link set dev $DEVICE up" is called. + # become 1 after "set_link_up $DEVICE" is called. if is_true "${STP}"; then if [ -n "${DELAY}" ]; then forward_delay="${DELAY}" @@ -164,7 +164,7 @@ fi # so it can actually get an IP. if is_false "$ISALIAS" && is_bonding_device ${DEVICE}; then install_bonding_driver ${DEVICE} - /sbin/ip link set dev ${DEVICE} up + set_link_up ${DEVICE} for device in $(LANG=C grep -l "^[[:space:]]*MASTER=['\"]\?${DEVICE}['\"]\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-*) ; do is_ignored_file "$device" && continue /sbin/ifup ${device##*/} || net_log "Unable to start slave device ${device##*/} for master ${DEVICE}." warning @@ -188,7 +188,7 @@ if [ -n "${BRIDGE}" ]; then 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 + set_link_up ${DEVICE} ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} ip link set dev ${DEVICE} master ${BRIDGE} @@ -243,7 +243,7 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then else if [ -z "${IPADDR}" -a -z "${IPADDR0}" -a -z "${IPADDR1}" -a -z "${IPADDR2}" ]; then # enable device without IP, useful for e.g. PPPoE - ip link set dev ${REALDEVICE} up + set_link_up ${REALDEVICE} ethtool_set [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} else @@ -253,7 +253,7 @@ else [ -n "${ARP}" ] && \ ip link set dev ${REALDEVICE} $(toggle_value arp $ARP) - if ! ip link set dev ${REALDEVICE} up ; then + if ! set_link_up ${REALDEVICE} ; then net_log $"Failed to bring up ${DEVICE}." exit 1 fi |