summaryrefslogtreecommitdiff
path: root/src/migration-scripts/interfaces/20-to-21
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-31 18:15:47 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-31 19:04:15 +0200
commit2bfd809e9ae198d95b9fcb556440637fdcc4005c (patch)
treeb3ed201903dc0a649888e40a7521036b2d235105 /src/migration-scripts/interfaces/20-to-21
parent031817eecb14280e3f421cb9c391ab29dbc2fa60 (diff)
downloadvyos-1x-2bfd809e9ae198d95b9fcb556440637fdcc4005c.tar.gz
vyos-1x-2bfd809e9ae198d95b9fcb556440637fdcc4005c.zip
ethernet: T2241: check if interface supports changing speed/duplex settings
Not all interface drivers have the ability to change the speed and duplex settings. Known drivers with this limitation are vmxnet3, virtio_net and xen_netfront. If this driver is detected, an error will be presented to the user. (cherry picked from commit cc742d48579e4f76e5d3230d87e22f71f76f9301)
Diffstat (limited to 'src/migration-scripts/interfaces/20-to-21')
-rwxr-xr-xsrc/migration-scripts/interfaces/20-to-2115
1 files changed, 15 insertions, 0 deletions
diff --git a/src/migration-scripts/interfaces/20-to-21 b/src/migration-scripts/interfaces/20-to-21
index 4b0e70d35..bd89dcdb4 100755
--- a/src/migration-scripts/interfaces/20-to-21
+++ b/src/migration-scripts/interfaces/20-to-21
@@ -89,6 +89,21 @@ for ifname in config.list_nodes(base):
if config.exists(base + [ifname, 'offload', 'ufo']):
config.delete(base + [ifname, 'offload', 'ufo'])
+ # Also while processing the interface configuration, not all adapters support
+ # changing the speed and duplex settings. If the desired speed and duplex
+ # values do not work for the NIC driver, we change them back to the default
+ # value of "auto" - which will be applied if the CLI node is deleted.
+ speed_path = base + [ifname, 'speed']
+ duplex_path = base + [ifname, 'duplex']
+ # speed and duplex must always be set at the same time if not set to "auto"
+ if config.exists(speed_path) and config.exists(duplex_path):
+ speed = config.return_value(speed_path)
+ duplex = config.return_value(duplex_path)
+ if speed != 'auto' and duplex != 'auto':
+ if not eth.check_speed_duplex(speed, duplex):
+ config.delete(speed_path)
+ config.delete(duplex_path)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())