From 38f31c805d7c79df7405a7b65d6775a4d762eb90 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 29 Nov 2019 22:07:05 +0100 Subject: pppoe: T1318: add first version of new XML/Python implementation vyos@vyos# show interfaces pppoe pppoe pppoe0 { default-route force link eth2.7 mtu 400 name-server auto password 12345678 user-id vyos@vyos.io } --- src/migration-scripts/interfaces/4-to-5 | 105 ++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 src/migration-scripts/interfaces/4-to-5 (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 new file mode 100755 index 000000000..a8f9addcf --- /dev/null +++ b/src/migration-scripts/interfaces/4-to-5 @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 + +# Change syntax of wireless interfaces +# Migrate boolean nodes to valueless + +from sys import exit +from vyos.configtree import ConfigTree + +def migrate_dialer(config, tree, intf): + for pppoe in config.list_nodes(tree): + # assemble string, 0 -> pppoe0 + new_base = ['interfaces', 'pppoe', 'pppoe' + pppoe] + config.set(new_base) + # format as tag node to avoid loading problems + config.set_tag(['interfaces', 'pppoe']) + + default_route = tree + [pppoe, 'default-route'] + print(default_route) + if config.exists(default_route): + tmp = config.return_value(default_route) + config.set(new_base + ['default-route'], value=tmp) + + disable = tree + [pppoe, 'disable'] + if config.exists(disable): + tmp = config.return_value(disable) + config.set(new_base + ['disable'], value=tmp) + + mtu = tree + [pppoe, 'mtu'] + if config.exists(mtu): + tmp = config.return_value(mtu) + config.set(new_base + ['mtu'], value=tmp) + + nameserver = tree + [pppoe, 'name-server'] + if config.exists(nameserver): + tmp = config.return_value(nameserver) + config.set(new_base + ['name-server'], value=tmp) + + password = tree + [pppoe, 'password'] + if config.exists(password): + tmp = config.return_value(password) + config.set(new_base + ['password'], value=tmp) + + userid = tree + [pppoe, 'user-id'] + if config.exists(userid): + tmp = config.return_value(userid) + config.set(new_base + ['user-id'], value=tmp) + + ipv6_enable = tree + [pppoe, 'enable-ipv6'] + if config.exists(ipv6_enable): + config.set(new_base + ['ipv6', 'enable']) + + ipv6_slaac = tree + [pppoe, 'ipv6', 'address', 'autoconf'] + if config.exists(ipv6_slaac): + config.set(new_base + ['ipv6', 'address', 'autoconf']) + + # Delete old PPPoE interface + config.delete(tree + [pppoe]) + + +if __name__ == '__main__': + + if (len(sys.argv) < 1): + print("Must specify file name!") + exit(1) + + file_name = sys.argv[1] + + with open(file_name, 'r') as f: + config_file = f.read() + + config = ConfigTree(config_file) + pppoe_links = ['bonding', 'ethernet'] + + for link_type in pppoe_links: + if not config.exists(['interfaces', link_type]): + continue + + for interface in config.list_nodes(['interfaces', link_type]): + # check if PPPoE exists + pppoe_if = ['interfaces', link_type, interface, 'pppoe'] + if config.exists(pppoe_if): + for dialer in config.list_nodes(pppoe_if): + migrate_dialer(config, pppoe_if, interface) + + # also migrate VLANs + if not config.exists(['interfaces', link_type, interface, 'vif']): + continue + + for vlan in config.list_nodes(['interfaces', link_type, interface, 'vif']): + pppoe_if = ['interfaces', link_type, interface, 'vif', vlan, 'pppoe'] + if config.exists(pppoe_if): + for dialer in config.list_nodes(pppoe_if): + intf = "{}.{}".format(interface, vlan) + migrate_dialer(config, pppoe_if, intf) + + + print(config.to_string()) + exit(1) + + try: + with open(file_name, 'w') as f: + f.write(config.to_string()) + except OSError as e: + print("Failed to save the modified config: {}".format(e)) + exit(1) -- cgit v1.2.3 From f7d00a91e42d668bb23a63673b4e1b36d8e319ef Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 21 Feb 2020 19:55:15 +0100 Subject: pppoe: T1318: fix migrator and add missing link statement --- src/migration-scripts/interfaces/4-to-5 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index a8f9addcf..15d841e89 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -1,9 +1,9 @@ #!/usr/bin/env python3 -# Change syntax of wireless interfaces +# De-nest PPPoE interfaces # Migrate boolean nodes to valueless -from sys import exit +import sys from vyos.configtree import ConfigTree def migrate_dialer(config, tree, intf): @@ -14,8 +14,10 @@ def migrate_dialer(config, tree, intf): # format as tag node to avoid loading problems config.set_tag(['interfaces', 'pppoe']) + # We need to assign a real interface to our dialer + config.set(new_base + ['link'], value=intf) + default_route = tree + [pppoe, 'default-route'] - print(default_route) if config.exists(default_route): tmp = config.return_value(default_route) config.set(new_base + ['default-route'], value=tmp) @@ -93,13 +95,9 @@ if __name__ == '__main__': intf = "{}.{}".format(interface, vlan) migrate_dialer(config, pppoe_if, intf) - - print(config.to_string()) - exit(1) - try: with open(file_name, 'w') as f: f.write(config.to_string()) except OSError as e: print("Failed to save the modified config: {}".format(e)) - exit(1) + sys.exit(1) -- cgit v1.2.3 From 4f8e30dec96c906ca32b1ab9b48ff70fc3564a61 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 22 Feb 2020 09:52:37 +0100 Subject: pppoe: T1318: proper delete old interfaces in migrator --- src/migration-scripts/interfaces/4-to-5 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index 15d841e89..2db9958d3 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -55,9 +55,9 @@ def migrate_dialer(config, tree, intf): if config.exists(ipv6_slaac): config.set(new_base + ['ipv6', 'address', 'autoconf']) - # Delete old PPPoE interface - config.delete(tree + [pppoe]) - + # Firewall migrieren + # QoS migrieren + # Quagga migrieren if __name__ == '__main__': @@ -84,6 +84,9 @@ if __name__ == '__main__': for dialer in config.list_nodes(pppoe_if): migrate_dialer(config, pppoe_if, interface) + # Delete old PPPoE interface + config.delete(pppoe_if) + # also migrate VLANs if not config.exists(['interfaces', link_type, interface, 'vif']): continue @@ -95,6 +98,9 @@ if __name__ == '__main__': intf = "{}.{}".format(interface, vlan) migrate_dialer(config, pppoe_if, intf) + # Delete old PPPoE interface + config.delete(pppoe_if) + try: with open(file_name, 'w') as f: f.write(config.to_string()) -- cgit v1.2.3 From c0a4166db01f7c9fa64e04eea8bd603c3e1a0922 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 22 Feb 2020 11:12:16 +0100 Subject: pppoe: T1318: extend migrator for firewall, qos and ip routing nodes --- Makefile | 2 ++ src/migration-scripts/interfaces/4-to-5 | 58 ++++++++++++++++++++++++++++----- 2 files changed, 51 insertions(+), 9 deletions(-) (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/Makefile b/Makefile index 62bddf4de..f859f2f45 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,8 @@ interface_definitions: $(BUILD_DIR) $(obj) rm -f $(TMPL_DIR)/interfaces/ethernet/node.tag/vif/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/ethernet/node.tag/vif-s/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/ethernet/node.tag/vif-s/node.tag/vif-c/node.tag/ip/node.def + rm -f $(TMPL_DIR)/interfaces/pppoe/node.tag/ip/node.def + rm -f $(TMPL_DIR)/interfaces/pppoe/node.tag/ipv6/node.def rm -f $(TMPL_DIR)/interfaces/pseudo-ethernet/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/pseudo-ethernet/node.tag/vif/node.tag/ip/node.def rm -f $(TMPL_DIR)/interfaces/pseudo-ethernet/node.tag/vif-s/node.tag/ip/node.def diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index 2db9958d3..db2be4a66 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -14,7 +14,42 @@ def migrate_dialer(config, tree, intf): # format as tag node to avoid loading problems config.set_tag(['interfaces', 'pppoe']) - # We need to assign a real interface to our dialer + # + # Firewall migrieren + # + firewall = tree + [pppoe, 'firewall'] + if config.exists(firewall): + config.copy(firewall, new_base + ['firewall']) + + policy = tree + [pppoe, 'policy'] + if config.exists(policy): + config.copy(policy, new_base + ['policy']) + + # + # QoS migrieren + # + redirect = tree + [pppoe, 'redirect'] + if config.exists(redirect): + config.copy(redirect, new_base + ['redirect']) + + traffic_policy = tree + [pppoe, 'traffic-policy'] + if config.exists(traffic_policy): + config.copy(traffic_policy, new_base + ['traffic-policy']) + + # + # Quagga migrieren + # + ip = tree + [pppoe, 'ip'] + if config.exists(ip): + config.copy(ip, new_base + ['ip']) + + ipv6 = tree + [pppoe, 'ipv6'] + if config.exists(ipv6): + config.copy(ipv6, new_base + ['ipv6']) + + # + # Interface migration + # config.set(new_base + ['link'], value=intf) default_route = tree + [pppoe, 'default-route'] @@ -47,6 +82,7 @@ def migrate_dialer(config, tree, intf): tmp = config.return_value(userid) config.set(new_base + ['user-id'], value=tmp) + # remove enable-ipv6 node and rather place it under ipv6 node ipv6_enable = tree + [pppoe, 'enable-ipv6'] if config.exists(ipv6_enable): config.set(new_base + ['ipv6', 'enable']) @@ -55,9 +91,6 @@ def migrate_dialer(config, tree, intf): if config.exists(ipv6_slaac): config.set(new_base + ['ipv6', 'address', 'autoconf']) - # Firewall migrieren - # QoS migrieren - # Quagga migrieren if __name__ == '__main__': @@ -79,7 +112,8 @@ if __name__ == '__main__': for interface in config.list_nodes(['interfaces', link_type]): # check if PPPoE exists - pppoe_if = ['interfaces', link_type, interface, 'pppoe'] + base_if = ['interfaces', link_type, interface] + pppoe_if = base_if + ['pppoe'] if config.exists(pppoe_if): for dialer in config.list_nodes(pppoe_if): migrate_dialer(config, pppoe_if, interface) @@ -87,12 +121,14 @@ if __name__ == '__main__': # Delete old PPPoE interface config.delete(pppoe_if) - # also migrate VLANs - if not config.exists(['interfaces', link_type, interface, 'vif']): + # bail out early if there are no VLAN interfaces to migrate + if not config.exists(base_if + ['vif']): continue - for vlan in config.list_nodes(['interfaces', link_type, interface, 'vif']): - pppoe_if = ['interfaces', link_type, interface, 'vif', vlan, 'pppoe'] + # Migrate PPPoE interfaces attached to a VLAN + for vlan in config.list_nodes(base_if + ['vif']): + vlan_if = base_if + ['vif', vlan] + pppoe_if = vlan_if + ['pppoe'] if config.exists(pppoe_if): for dialer in config.list_nodes(pppoe_if): intf = "{}.{}".format(interface, vlan) @@ -101,6 +137,10 @@ if __name__ == '__main__': # Delete old PPPoE interface config.delete(pppoe_if) + # Add interface description that this is required for PPPoE + if not config.exists(vlan_if + ['description']): + config.set(vlan_if + ['description'], value='PPPoE link interface') + try: with open(file_name, 'w') as f: f.write(config.to_string()) -- cgit v1.2.3 From 07273632fcf59d04be988f2c43fe53e7bec8d46a Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 23 Feb 2020 12:22:34 +0100 Subject: pppoe: T1318: rename link to source-interface --- interface-definitions/interfaces-pppoe.xml.in | 4 +- src/conf_mode/interfaces-pppoe.py | 16 ++--- src/migration-scripts/interfaces/4-to-5 | 91 +++++---------------------- 3 files changed, 24 insertions(+), 87 deletions(-) (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in index 93b07f4e4..8bae0e490 100644 --- a/interface-definitions/interfaces-pppoe.xml.in +++ b/interface-definitions/interfaces-pppoe.xml.in @@ -90,11 +90,11 @@ - + Physical Interface used for this PPPoE session - + diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index 6ab3fbd95..49902b989 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -64,7 +64,7 @@ noauth noproxyarp plugin rp-pppoe.so -{{ link }} +{{ source_interface }} persist ifname {{ intf }} ipparam {{ intf }} @@ -100,14 +100,14 @@ default_config_data = { 'idle_timeout': '', 'ipv6_autoconf': False, 'ipv6_enable': False, - 'link': '', 'local_address': '', 'mtu': '1492', 'name_server': 'auto', 'password': '', 'remote_address': '', 'service_name': '', - 'user_id': '' + 'user_id': '', + 'source_interface': '' } def subprocess_cmd(command): @@ -165,13 +165,13 @@ def get_config(): if conf.exists(['ipv6', 'enable']): pppoe['ipv6_enable'] = True - # IPv4 address of local end of the PPPoE link + # IPv4 address of local end of PPPoE link if conf.exists(['local-address']): pppoe['local_address'] = conf.return_value(['local-address']) # Physical Interface used for this PPPoE session - if conf.exists(['link']): - pppoe['link'] = conf.return_value('link') + if conf.exists(['source-interface']): + pppoe['source_interface'] = conf.return_value('source-interface') # Maximum Transmission Unit (MTU) if conf.exists(['mtu']): @@ -204,8 +204,8 @@ def verify(pppoe): # bail out early return None - if not pppoe['link']: - raise ConfigError('Physical link interface for PPPoE missing') + if not pppoe['source_interface']: + raise ConfigError('PPPoE source interface is missing') return None diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index db2be4a66..0683861f2 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -9,91 +9,28 @@ from vyos.configtree import ConfigTree def migrate_dialer(config, tree, intf): for pppoe in config.list_nodes(tree): # assemble string, 0 -> pppoe0 - new_base = ['interfaces', 'pppoe', 'pppoe' + pppoe] + new_base = ['interfaces', 'pppoe'] + pppoe_base = new_base + ['pppoe' + pppoe] config.set(new_base) # format as tag node to avoid loading problems - config.set_tag(['interfaces', 'pppoe']) - - # - # Firewall migrieren - # - firewall = tree + [pppoe, 'firewall'] - if config.exists(firewall): - config.copy(firewall, new_base + ['firewall']) - - policy = tree + [pppoe, 'policy'] - if config.exists(policy): - config.copy(policy, new_base + ['policy']) - - # - # QoS migrieren - # - redirect = tree + [pppoe, 'redirect'] - if config.exists(redirect): - config.copy(redirect, new_base + ['redirect']) - - traffic_policy = tree + [pppoe, 'traffic-policy'] - if config.exists(traffic_policy): - config.copy(traffic_policy, new_base + ['traffic-policy']) - - # - # Quagga migrieren - # - ip = tree + [pppoe, 'ip'] - if config.exists(ip): - config.copy(ip, new_base + ['ip']) - - ipv6 = tree + [pppoe, 'ipv6'] - if config.exists(ipv6): - config.copy(ipv6, new_base + ['ipv6']) - - # - # Interface migration - # - config.set(new_base + ['link'], value=intf) - - default_route = tree + [pppoe, 'default-route'] - if config.exists(default_route): - tmp = config.return_value(default_route) - config.set(new_base + ['default-route'], value=tmp) - - disable = tree + [pppoe, 'disable'] - if config.exists(disable): - tmp = config.return_value(disable) - config.set(new_base + ['disable'], value=tmp) - - mtu = tree + [pppoe, 'mtu'] - if config.exists(mtu): - tmp = config.return_value(mtu) - config.set(new_base + ['mtu'], value=tmp) - - nameserver = tree + [pppoe, 'name-server'] - if config.exists(nameserver): - tmp = config.return_value(nameserver) - config.set(new_base + ['name-server'], value=tmp) - - password = tree + [pppoe, 'password'] - if config.exists(password): - tmp = config.return_value(password) - config.set(new_base + ['password'], value=tmp) - - userid = tree + [pppoe, 'user-id'] - if config.exists(userid): - tmp = config.return_value(userid) - config.set(new_base + ['user-id'], value=tmp) + config.set_tag(new_base) + + # Copy the entire old node to the new one before migrating individual + # parts + config.copy(tree + [pppoe], pppoe_base) + # remove enable-ipv6 node and rather place it under ipv6 node - ipv6_enable = tree + [pppoe, 'enable-ipv6'] - if config.exists(ipv6_enable): - config.set(new_base + ['ipv6', 'enable']) + if config.exists(pppoe_base + ['enable-ipv6']): + config.set(pppoe_base + ['ipv6', 'enable']) + config.delete(pppoe_base + ['enable-ipv6']) - ipv6_slaac = tree + [pppoe, 'ipv6', 'address', 'autoconf'] - if config.exists(ipv6_slaac): - config.set(new_base + ['ipv6', 'address', 'autoconf']) + # Source interface migration + config.set(pppoe_base + ['source-interface'], value=intf) -if __name__ == '__main__': +if __name__ == '__main__': if (len(sys.argv) < 1): print("Must specify file name!") exit(1) -- cgit v1.2.3 From 3d0162557f9c2217d4a925e6c893863b1af55e58 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 23 Feb 2020 12:26:34 +0100 Subject: pppoe: T1318: migrate user-id and password nodes under an authentication node --- interface-definitions/interfaces-pppoe.xml.in | 27 ++++++++++++++++---------- src/conf_mode/interfaces-pppoe.py | 28 +++++++++++++-------------- src/migration-scripts/interfaces/4-to-5 | 11 +++++++++++ 3 files changed, 42 insertions(+), 24 deletions(-) (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in index 8bae0e490..933d9edf1 100644 --- a/interface-definitions/interfaces-pppoe.xml.in +++ b/interface-definitions/interfaces-pppoe.xml.in @@ -26,6 +26,23 @@ Access concentrator name must be composed of uppper and lower case letters or numbers only + + + Authentication settings + + + + + User name + + + + + Password + + + + Automatic establishment of PPPOE connection when traffic is sent @@ -143,11 +160,6 @@ Must be either 'auto' or 'none' - - - Password for authenticating local machine to PPPoE server - - IPv4 address of remote end of the PPPoE link @@ -169,11 +181,6 @@ Service name must be composed of uppper and lower case letters or numbers only - - - Authentication name supplied to PPPoE server - - diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index 49902b989..d2147fa1f 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -78,9 +78,9 @@ replacedefaultroute {% endif %} mtu {{ mtu }} mru {{ mtu }} -user "{{ user_id }}" -password "{{ password }}" -{% if 'auto' in name_server -%} +user "{{ auth_username }}" +password "{{ auth_password }}" +{% if name_server -%} usepeerdns {% endif %} {% if ipv6_enable -%} @@ -91,6 +91,8 @@ usepeerdns default_config_data = { 'access_concentrator': '', + 'auth_username': '', + 'auth_password': '', 'on_demand': False, 'default_route': 'auto', 'deleted': False, @@ -103,10 +105,8 @@ default_config_data = { 'local_address': '', 'mtu': '1492', 'name_server': 'auto', - 'password': '', 'remote_address': '', 'service_name': '', - 'user_id': '', 'source_interface': '' } @@ -137,6 +137,14 @@ def get_config(): if conf.exists(['access-concentrator']): pppoe['access_concentrator'] = conf.return_values(['access-concentrator']) + # Authentication name supplied to PPPoE server + if conf.exists(['authentication', 'user']): + pppoe['auth_username'] = conf.return_value(['authentication', 'user']) + + # Password for authenticating local machine to PPPoE server + if conf.exists(['authentication', 'password']): + pppoe['auth_password'] = conf.return_value(['authentication', 'password']) + # Access concentrator name (only connect to this concentrator) if conf.exists(['connect-on-demand']): pppoe['on_demand'] = True @@ -181,11 +189,7 @@ def get_config(): if conf.exists(['name-server']): pppoe['name_server'] = conf.return_value(['name-server']) - # Password for authenticating local machine to PPPoE server - if conf.exists(['password']): - pppoe['password'] = conf.return_value(['password']) - - # IPv4 address of local end of the PPPoE link + # IPv4 address for remote end of PPPoE session if conf.exists(['remote-address']): pppoe['remote_address'] = conf.return_value(['remote-address']) @@ -193,10 +197,6 @@ def get_config(): if conf.exists(['service-name']): pppoe['service_name'] = conf.return_value(['service-name']) - # Authentication name supplied to PPPoE server - if conf.exists(['user-id']): - pppoe['user_id'] = conf.return_value(['user-id']) - return pppoe def verify(pppoe): diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index 0683861f2..19e0352c8 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -19,6 +19,17 @@ def migrate_dialer(config, tree, intf): # parts config.copy(tree + [pppoe], pppoe_base) + # Migrate user-id and password nodes under an 'authentication' + # node + if config.exists(pppoe_base + ['user-id']): + user = config.return_value(pppoe_base + ['user-id']) + config.set(pppoe_base + ['authentication', 'user'], value=user) + config.delete(pppoe_base + ['user-id']) + + if config.exists(pppoe_base + ['password']): + pwd = config.return_value(pppoe_base + ['password']) + config.set(pppoe_base + ['authentication', 'password'], value=pwd) + config.delete(pppoe_base + ['password']) # remove enable-ipv6 node and rather place it under ipv6 node if config.exists(pppoe_base + ['enable-ipv6']): -- cgit v1.2.3 From cf5b8ca0f6de111e792c3243c8e1adc8bdb998c6 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 23 Feb 2020 12:27:12 +0100 Subject: pppoe: T2055: remove router-advert node in client interface --- src/migration-scripts/interfaces/4-to-5 | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index 19e0352c8..dd1e9a51e 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -39,6 +39,12 @@ def migrate_dialer(config, tree, intf): # Source interface migration config.set(pppoe_base + ['source-interface'], value=intf) + # Remove IPv6 router-advert nodes as this makes no sense on a + # client diale rinterface to send RAs back into the network + # https://phabricator.vyos.net/T2055 + ipv6_ra = pppoe_base + ['ipv6', 'router-advert'] + if config.exists(ipv6_ra): + config.delete(ipv6_ra) if __name__ == '__main__': -- cgit v1.2.3 From 2fec7394434f8daace485e97a7287cc8233fa178 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 23 Feb 2020 12:27:55 +0100 Subject: pppoe: T1318: declutter name-server CLI nodes Instead of letting the user choose between auto and none where auto is default, it makes more sesne to just offer an option to disable the default behavior. --- interface-definitions/interfaces-pppoe.xml.in | 20 +++----------------- src/conf_mode/interfaces-pppoe.py | 8 ++++---- src/migration-scripts/interfaces/4-to-5 | 9 +++++++++ 3 files changed, 16 insertions(+), 21 deletions(-) (limited to 'src/migration-scripts/interfaces/4-to-5') diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in index 933d9edf1..b6b54c915 100644 --- a/interface-definitions/interfaces-pppoe.xml.in +++ b/interface-definitions/interfaces-pppoe.xml.in @@ -140,24 +140,10 @@ MTU must be between 68 and 1500 - + - Enable/Disable use of name server entries from peer - - auto none - - - auto - Install default route when link comes up - - - none - Do not install default route when link comes up - - - (auto|none) - - Must be either 'auto' or 'none' + Do not use DNS servers provided by the peer + diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py index d2147fa1f..4ca7f3ecb 100755 --- a/src/conf_mode/interfaces-pppoe.py +++ b/src/conf_mode/interfaces-pppoe.py @@ -104,7 +104,7 @@ default_config_data = { 'ipv6_enable': False, 'local_address': '', 'mtu': '1492', - 'name_server': 'auto', + 'name_server': True, 'remote_address': '', 'service_name': '', 'source_interface': '' @@ -185,9 +185,9 @@ def get_config(): if conf.exists(['mtu']): pppoe['mtu'] = conf.return_value(['mtu']) - # IPv4 address of local end of the PPPoE link - if conf.exists(['name-server']): - pppoe['name_server'] = conf.return_value(['name-server']) + # Do not use DNS servers provided by the peer + if conf.exists(['no-peer-dns']): + pppoe['name_server'] = False # IPv4 address for remote end of PPPoE session if conf.exists(['remote-address']): diff --git a/src/migration-scripts/interfaces/4-to-5 b/src/migration-scripts/interfaces/4-to-5 index dd1e9a51e..2a42c60ff 100755 --- a/src/migration-scripts/interfaces/4-to-5 +++ b/src/migration-scripts/interfaces/4-to-5 @@ -19,6 +19,15 @@ def migrate_dialer(config, tree, intf): # parts config.copy(tree + [pppoe], pppoe_base) + # Instead of letting the user choose between auto and none + # where auto is default, it makes more sesne to just offer + # an option to disable the default behavior (declutter CLI) + if config.exists(pppoe_base + ['name-server']): + tmp = config.return_value(pppoe_base + ['name-server']) + if tmp == "none": + config.set(pppoe_base + ['no-peer-dns']) + config.delete(pppoe_base + ['name-server']) + # Migrate user-id and password nodes under an 'authentication' # node if config.exists(pppoe_base + ['user-id']): -- cgit v1.2.3