diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-13 16:36:30 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-20 21:28:53 +0200 |
commit | fc7685dcbb47a4f80a3e554efa8f60799009151b (patch) | |
tree | f13e03cfd88b658866b45c9251bbd281cc2137f5 /src/conf_mode | |
parent | 66884984c7b4b5b445322828541a942fa9e705c1 (diff) | |
download | vyos-1x-fc7685dcbb47a4f80a3e554efa8f60799009151b.tar.gz vyos-1x-fc7685dcbb47a4f80a3e554efa8f60799009151b.zip |
ethernet: T1637: change speed and duplex settings
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/interface-ethernet.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py index 3091e0717..30e7c4b1f 100755 --- a/src/conf_mode/interface-ethernet.py +++ b/src/conf_mode/interface-ethernet.py @@ -35,6 +35,7 @@ default_config_data = { 'dhcpv6_temporary': False, 'disable': False, 'disable_link_detect': 1, + 'duplex': 'auto', 'flow_control': 'on', 'hw_id': '', 'ip_arp_cache_tmo': 30, @@ -43,6 +44,7 @@ default_config_data = { 'intf': '', 'mac': '', 'mtu': 1500, + 'speed': 'auto', 'vif_s': [], 'vif_s_remove': [], 'vif': [], @@ -153,6 +155,10 @@ def get_config(): if conf.exists('disable'): eth['disable'] = True + # interface duplex + if conf.exists('duplex'): + eth['duplex'] = conf.return_value('duplex') + # ARP cache entry timeout in seconds if conf.exists('ip arp-cache-timeout'): eth['ip_arp_cache_tmo'] = int(conf.return_value('ip arp-cache-timeout')) @@ -173,6 +179,10 @@ def get_config(): if conf.exists('mtu'): eth['mtu'] = int(conf.return_value('mtu')) + # interface speed + if conf.exists('speed'): + eth['speed'] = conf.return_value('speed') + # re-set configuration level and retrieve vif-s interfaces conf.set_level(cfg_base) # get vif-s interfaces (currently effective) - to determine which vif-s @@ -205,6 +215,14 @@ def get_config(): def verify(eth): + if eth['speed'] == 'auto': + if eth['duplex'] != 'auto': + raise ConfigError('If speed is hardcoded, duplex must be hardcoded, too') + + if eth['duplex'] == 'auto': + if eth['speed'] != 'auto': + raise ConfigError('If duplex is hardcoded, speed must be hardcoded, too') + conf = Config() # some options can not be changed when interface is enslaved to a bond for bond in conf.list_nodes('interfaces bonding'): @@ -256,6 +274,9 @@ def apply(eth): # Maximum Transmission Unit (MTU) e.mtu = eth['mtu'] + # Set physical interface speed and duplex + e.set_speed_duplex(eth['speed'], eth['duplex']) + # Configure interface address(es) # - not longer required addresses get removed first # - newly addresses will be added second |