|
13 | 13 | # |
14 | 14 | # You should have received a copy of the GNU General Public License |
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | | -# |
17 | | -# T6318: WiFi country-code should be set system-wide instead of per-device |
18 | 16 |
|
19 | | -from vyos.configtree import ConfigTree |
| 17 | +# T7646: restore behavior of IPv6 default route if only dhcpv6 was defined but |
| 18 | +# not "ipv6 address autoconf" |
20 | 19 |
|
21 | | -base = ['interfaces', 'wireless'] |
| 20 | +from vyos.configtree import ConfigTree |
22 | 21 |
|
23 | 22 | def migrate(config: ConfigTree) -> None: |
24 | | - if not config.exists(base): |
25 | | - # Nothing to do |
26 | | - return |
| 23 | + for type in config.list_nodes(['interfaces']): |
| 24 | + for interface in config.list_nodes(['interfaces', type]): |
| 25 | + iface_base_path = ['interfaces', type, interface] |
| 26 | + dhcpv6_addr_path = iface_base_path + ['address', 'dhcpv6'] |
| 27 | + autoconf_path = iface_base_path + ['ipv6', 'address', 'autoconf'] |
| 28 | + if config.exists(dhcpv6_addr_path) and not config.exists(autoconf_path): |
| 29 | + config.set(autoconf_path) |
| 30 | + |
| 31 | + vif_path = iface_base_path + ['vif'] |
| 32 | + if config.exists(vif_path): |
| 33 | + for vif in config.list_nodes(vif_path): |
| 34 | + vif_dhcpv6_addr_path = vif_path + [vif, 'address'] |
| 35 | + vif_autoconf_path = vif_path + [vif, 'ipv6', 'address', 'autoconf'] |
| 36 | + if config.exists(vif_dhcpv6_addr_path) and not config.exists(vif_autoconf_path): |
| 37 | + config.set(vif_autoconf_path) |
27 | 38 |
|
28 | | - installed = False |
29 | | - for interface in config.list_nodes(base): |
30 | | - cc_path = base + [interface, 'country-code'] |
31 | | - if config.exists(cc_path): |
32 | | - tmp = config.return_value(cc_path) |
33 | | - config.delete(cc_path) |
| 39 | + vif_s_path = iface_base_path + ['vif-s'] |
| 40 | + if config.exists(vif_s_path): |
| 41 | + for vif_s in config.list_nodes(vif_s_path): |
| 42 | + vif_s_dhcpv6_addr_path = vif_s_path + [vif_s, 'address'] |
| 43 | + vif_s_autoconf_path = vif_s_path + [vif_s, 'ipv6', 'address', 'autoconf'] |
| 44 | + if config.exists(vif_s_dhcpv6_addr_path) and not config.exists(vif_s_autoconf_path): |
| 45 | + config.set(vif_s_autoconf_path) |
34 | 46 |
|
35 | | - # There can be only ONE wireless country-code per device, everything |
36 | | - # else makes no sense as a WIFI router can not operate in two |
37 | | - # different countries |
38 | | - if not installed: |
39 | | - config.set(['system', 'wireless', 'country-code'], value=tmp) |
40 | | - installed = True |
| 47 | + vif_c_path = iface_base_path + ['vif-s', vif_s, 'vif-c'] |
| 48 | + if config.exists(vif_c_path): |
| 49 | + for vif_c in config.list_nodes(vif_c_path): |
| 50 | + vif_c_dhcpv6_addr_path = vif_c_path + [vif_c, 'address'] |
| 51 | + vif_c_autoconf_path = vif_c_path + [vif_c, 'ipv6', 'address', 'autoconf'] |
| 52 | + if config.exists(vif_c_dhcpv6_addr_path) and not config.exists(vif_c_autoconf_path): |
| 53 | + config.set(vif_c_autoconf_path) |
0 commit comments