renderer: add support for rendering IPv6 schema properties

Also consolidate existing IPv4 interface config while we're at it.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich
2021-05-20 22:15:40 +02:00
committed by John Crispin
parent b98b153a54
commit e2590c3338
7 changed files with 119 additions and 80 deletions

View File

@@ -1,15 +1,11 @@
set network.{{name}}=interface_4
set network.{{ name }}_4.ucentral_name={{ s(interface.name) }}
set network.{{ name }}_4.ucentral_path={{ s(location) }}
set network.{{ name }}_4.ifname={{ netdev }}
set network.{{ name }}_4.metric={{ interface.metric }}
{% if (interface.role == 'upstream' && interface.vlan): %}
set network.{{ name }}_4.ip4table={{ this_vid }}
{% endif %}
{% if (ipv4_mode == 'static'): %}
set network.{{ name }}_4.proto=static
set network.{{ name }}_4.ipaddr={{ ipcalc.generate_prefix(state, interface.ipv4.subnet) }}
{% else %}
set network.{{ name }}_4.proto=dhcp
{% endif %}
set network.{{ name }}.ip4table={{ this_vid }}
{% endif %}
{% if (ipv4_mode == 'static'): %}
set network.{{ name }}.ipaddr={{ ipcalc.generate_prefix(state, ipv4.subnet, false) }}
{% else %}
set network.{{ name }}.peerdns={{ b(!length(ipv4.use_dns)) }}
{% for (let dns in ipv4.use_dns): %}
add_list network.{{ name }}.dns={{ dns }}
{% endfor %}
{% endif %}