{%- set B = xbuildout.encode -%}

dhcp-leasefile={{ directory['etc'] }}/dnsmasq.leases
port=5354

{%- for (ru_ref, iru) in iru_dict|dictsort | selectattr('1._.cpri_link', 'defined') %}
{%-   set ru = iru['_'] %}
{%-   set ru_tap = ru.cpri_link._tap  %}
{%-   set vtap = json_module.loads(vtap_jdict[ru_tap])  %}
{%-   set plen = netaddr.IPNetwork(vtap.network).prefixlen  %}

# {{ B(ru_ref) }} @ {{ ru_tap }}
{#- TODO consider using /128 as we give only 1 address to RU #}
dhcp-range=tag:{{ ru_tap }},{{ vtap.gateway }},{{ vtap.gateway }},static,{{ max(plen,64) }},5m
dhcp-host={{ ru.mac_addr }},tag:{{ ru_tap }},[{{ vtap.gateway }}]
# option 17 used for RU callhome
# dhcp-option=option6:17,[{{ vtap.addr }}]
{%- endfor %}

log-queries
log-dhcp
log-facility={{ directory['home'] }}/var/log/dnsmasq.log
enable-ra
ra-param=adv-send-advert
ra-param=adv-managed-flag
ra-param=adv-other-config-flag
ra-param=adv-autonomous
