diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-04-11 21:11:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 21:11:15 +0200 |
commit | d214d689a6c01b333f62362457959b5cfd48f9f5 (patch) | |
tree | e540190c78d9256a362545375b3a660a89bea0ee | |
parent | c8ae06b581cbf1a19789500ae15d07a863724272 (diff) | |
parent | 7dd917def1e250e63b097f6fd8958b9b07a7d57e (diff) | |
download | vyos-1x-d214d689a6c01b333f62362457959b5cfd48f9f5.tar.gz vyos-1x-d214d689a6c01b333f62362457959b5cfd48f9f5.zip |
Merge pull request #1282 from dmbaturin/T4327
T4327: ignore PermissionError caused by ethtool spee/duplex/autoneg setting
-rw-r--r-- | python/vyos/ifconfig/ethernet.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index 9d54dc78e..1280fc238 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -170,11 +170,18 @@ class EthernetIf(Interface): return cmd = f'ethtool --change {ifname}' - if speed == 'auto' or duplex == 'auto': - cmd += ' autoneg on' - else: - cmd += f' speed {speed} duplex {duplex} autoneg off' - return self._cmd(cmd) + try: + if speed == 'auto' or duplex == 'auto': + cmd += ' autoneg on' + else: + cmd += f' speed {speed} duplex {duplex} autoneg off' + return self._cmd(cmd) + except PermissionError: + # Some NICs do not tell that they don't suppport settings speed/duplex, + # but they do not actually support it either. + # In that case it's probably better to ignore the error + # than end up with a broken config. + print('Warning: could not set speed/duplex settings: operation not permitted!') def set_gro(self, state): """ |