alpine: don’t set gateway for interface if the gateway is that interface

This commit is contained in:
Timotej Lazar 2024-08-06 15:47:05 +02:00
parent 6e35a7462d
commit 38ff061f81

View file

@ -9,7 +9,7 @@ iface {{ iface.name }} inet static
{% set subnet = ip.address | ipaddr('subnet') %} {% set subnet = ip.address | ipaddr('subnet') %}
{% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %} {% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %}
{% set gateway = prefix.custom_fields.gateway.address %} {% set gateway = prefix.custom_fields.gateway.address %}
{% if gateway is defined %} {% if gateway is defined and gateway != ip.address %}
gateway {{ gateway | ipaddr('address') }} gateway {{ gateway | ipaddr('address') }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}