summaryrefslogtreecommitdiff
path: root/data/templates/dhcp-client/ipv6.j2
blob: 311c856c8ea6674456ac5adad4a98182b7d5f35f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
### Autogenerated by interface.py ###

# man https://www.unix.com/man-page/debian/5/dhcp6c.conf/
interface {{ ifname }} {
{% if dhcpv6_options.duid is vyos_defined %}
    send client-id {{ dhcpv6_options.duid }};
{% endif %}
{% if address is vyos_defined and 'dhcpv6' in address %}
    request domain-name-servers;
    request domain-name;
{%     if dhcpv6_options.parameters_only is vyos_defined %}
    information-only;
{%     endif %}
{%     if dhcpv6_options.temporary is not vyos_defined %}
    send ia-na 0; # non-temporary address
{%     endif %}
{%     if dhcpv6_options.rapid_commit is vyos_defined %}
    send rapid-commit; # wait for immediate reply instead of advertisements
{%     endif %}
{% endif %}
{% if dhcpv6_options.pd is vyos_defined %}
{%     for pd in dhcpv6_options.pd %}
    send ia-pd {{ pd }}; # prefix delegation #{{ pd }}
{%     endfor %}
{% endif %}
    script "{{ dhcp6_script_file }}";
};

{% if address is vyos_defined and 'dhcpv6' in address %}
{%     if dhcpv6_options.temporary is not vyos_defined %}
id-assoc na 0 {
    # Identity association for non temporary address
};
{%     endif %}
{% endif %}

{% if dhcpv6_options.pd is vyos_defined %}
{%     for pd, pd_config in dhcpv6_options.pd.items() %}
id-assoc pd {{ pd }} {
{#   length got a default value #}
    prefix ::/{{ pd_config.length }} infinity;
{%         set sla_len = 64 - pd_config.length | int %}
{%         set count = namespace(value=0) %}
{%         if pd_config.interface is vyos_defined %}
{%             for interface, interface_config in pd_config.interface.items() if pd_config.interface is vyos_defined %}
    prefix-interface {{ interface }} {
        sla-len {{ sla_len }};
{%                 if interface_config.sla_id is vyos_defined %}
        sla-id {{ interface_config.sla_id }};
{%                 else %}
        sla-id {{ count.value }};
{%                 endif %}
{%                 if interface_config.address is vyos_defined %}
        ifid {{ interface_config.address }};
{%                 endif %}
    };
{%                 set count.value = count.value + 1 %}
{%             endfor %}
{%         endif %}
};
{%     endfor %}
{% endif %}