Unbound: disabling the first DNS override entry invalides config. closes https://github.com/opnsense/core/issues/5798

This commit is contained in:
Ad Schellevis 2022-05-31 19:17:32 +02:00
parent 03f43d6c5b
commit cdcf22e80d

View File

@ -1,10 +1,12 @@
{% if not helpers.empty('OPNsense.unboundplus.domains.domain') %}
{% set forwardlocal = namespace(found=false) %}
{% set prev_domain = namespace(name='') %}
{% for domain in helpers.toList('OPNsense.unboundplus.domains.domain', 'domain') %}
{% if domain.enabled == '1' %}
{% if not loop.previtem or loop.previtem.domain != domain.domain %}
{% if prev_domain.name != domain.domain %}
forward-zone:
name: "{{ domain.domain }}"
{% set prev_domain.name = domain.domain %}
{% if domain.server.startswith('127.') or domain.server == '::1' %}
{% set forwardlocal.found = true %}
{% endif %}