50 lines
2.0 KiB
Django/Jinja
50 lines
2.0 KiB
Django/Jinja
{%- import '_common.j2' as common_opts with context -%}
|
|
# This file should be *included* in your dnsmasq configuration.
|
|
# Generated by he_ipv6.
|
|
# See "dnsmasq --help dhcp6" for matching option identifers ("dhcp-option = ..., option6: <option>").
|
|
enable-ra
|
|
{% for assignment in assignments %}
|
|
{%- set assign_loop = loop -%}
|
|
{%- set ra_opts = [] -%}
|
|
{%- if assignment.ra_tag -%}
|
|
{%- set id_set = 'tag:' + assignment.ra_tag -%}
|
|
{%- set identifier = id_set -%}
|
|
{%- set do_listen = false -%}
|
|
{%- else -%}
|
|
{%- set id_set = 'set:' + assignment.iface -%}
|
|
{%- set identifier = 'tag:' + assignment.iface -%}
|
|
{%- set do_listen = true -%}
|
|
{%- endif -%}
|
|
{%- if assignment.ra_dns -%}
|
|
{%- do ra_opts.append('sa-names') -%}
|
|
{%- endif -%}
|
|
{%- if assignment.ra_dhcp is false -%}
|
|
{%- do ra_opts.append('ra-only') -%}
|
|
{%- if assignment.ra_other is true -%}
|
|
{%- do ra_opts.append('ra-stateless') -%}
|
|
{%- endif -%}
|
|
{%- endif -%}
|
|
{%- do ra_opts.append('slaac') -%}
|
|
{%- do ra_opts.append('ra-names') -%}
|
|
# {{ assignment.iface }} assignment
|
|
{%- if do_listen %}
|
|
listen = {{ assignment.iface_ll }}
|
|
{%- endif %}
|
|
ra-param = {{ assignment.iface }}, mtu:{{ common_opts.mtu }}, high, {{ common_opts.min_delay }}, {{ common_opts.lifetime }}
|
|
{%- if assignment.ra_dhcp %}
|
|
{%- for block in assignment.iface_blocks %}
|
|
dhcp-range = {{ id_set }}, {{ assignment.dhcp6_ranges[assign_loop.index0]|join(', ') }}, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}
|
|
{%- endfor %}
|
|
{%- else %}
|
|
dhcp-range = {{ id_set }}, ::, constructor={{ assignment.iface }}, {{ ra_opts|join(', ') }}, {{ common_opts.lease_life }}{#- TODO: check this. #}
|
|
{%- endif %}
|
|
dhcp-option = {{ identifier }}, option6:information-refresh-time, {{ common_opts.opts_life }}
|
|
{%- if assignment.ra_dns %}
|
|
dhcp-option = {{ identifier }}, option6:dns-server, [{{ assignment.iface_ll }}]
|
|
{%- endif %}
|
|
{%- if assignment.ra_domains %}
|
|
dhcp-option = {{ identifier }}, option6:domain-search, {{ assignment.ra_domains|join(',') }}
|
|
{%- endif %}
|
|
|
|
{% endfor %}
|