summaryrefslogtreecommitdiff
path: root/data/templates/firewall/nftables-geoip-update.j2
blob: f9e61a274ad093690da94cbe2dd17bac75dacfe2 (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
#!/usr/sbin/nft -f

{% if ipv4_sets is vyos_defined %}
{%     for setname, ip_list in ipv4_sets.items() %}
flush set ip filter {{ setname }}
{%     endfor %}

table ip filter {
{%     for setname, ip_list in ipv4_sets.items() %}
    set {{ setname }} {
        type ipv4_addr
        flags interval
        elements = { {{ ','.join(ip_list) }} }
    }
{%     endfor %}
}
{% endif %}

{% if ipv6_sets is vyos_defined %}
{%     for setname, ip_list in ipv6_sets.items() %}
flush set ip6 filter {{ setname }}
{%     endfor %}

table ip6 filter {
{%     for setname, ip_list in ipv6_sets.items() %}
    set {{ setname }} {
        type ipv6_addr
        flags interval
        elements = { {{ ','.join(ip_list) }} }
    }
{%     endfor %}
}
{% endif %}