summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/vyos/ifconfig.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 8a4ad6ffc..cc63482de 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -21,6 +21,7 @@ import glob
import time
import vyos.interfaces
+
from vyos.validate import *
from vyos.config import Config
from vyos import ConfigError
@@ -1085,6 +1086,24 @@ class EthernetIf(VLANIf):
.format(self.get_driver_name()))
return
+ # Get current flow control settings:
+ cmd = '/sbin/ethtool --show-pause {0}'.format(self._ifname)
+ tmp = self._cmd(cmd)
+
+ # The above command returns - with tabs:
+ #
+ # Pause parameters for eth0:
+ # Autonegotiate: on
+ # RX: off
+ # TX: off
+ if re.search("Autonegotiate:\ton", tmp):
+ if enable == "on":
+ # flowcontrol is already enabled - no need to re-enable it again
+ # this will prevent the interface from flapping as applying the
+ # flow-control settings will take the interface down and bring
+ # it back up every time.
+ return
+
# Assemble command executed on system. Unfortunately there is no way
# to change this setting via sysfs
cmd = '/sbin/ethtool --pause {0} autoneg {1} tx {1} rx {1}'.format(