summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2018-09-04 06:28:38 +0200
committerChristian Poessinger <christian@poessinger.com>2018-09-04 06:28:38 +0200
commit93f6b6a3b23f4169a4af4a23eb795d041be84e42 (patch)
treefee4f1610e611d3cd75d6a4d3bd36730e404abfe /src/conf_mode
parentd31d16d38c191a8973d79302b108db7276aef7fd (diff)
downloadvyos-1x-93f6b6a3b23f4169a4af4a23eb795d041be84e42.tar.gz
vyos-1x-93f6b6a3b23f4169a4af4a23eb795d041be84e42.zip
dhcp_server.py: bugfix pool assignment
Commit 91c3b8bdd9 ("dhcp_server.py: cleanup") did not only cleanup parts of the code but in addition added support for DHCP failover. That support could lead to an empty pool {} statement if the subnet declaration only had static address assignments but no range at all. ---<snip>--- dhcpd: /etc/dhcp/dhcpd.conf line 70: Pool declaration with no address range. dhcpd: } dhcpd: ^ dhcpd: Pool declarations must always contain at least dhcpd: one range statement. ---</snip>---
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/dhcp_server.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/conf_mode/dhcp_server.py b/src/conf_mode/dhcp_server.py
index a26e4626a..2a2b1fe6c 100755
--- a/src/conf_mode/dhcp_server.py
+++ b/src/conf_mode/dhcp_server.py
@@ -195,15 +195,19 @@ shared-network {{ network.name }} {
}
{%- endif %}
{%- endfor %}
+ {%- if subnet.failover_name %}
pool {
- {%- if subnet.failover_name %}
failover peer "{{ subnet.failover_name }}";
deny dynamic bootp clients;
- {%- endif %}
{%- for range in subnet.range %}
range {{ range.start }} {{ range.stop }};
{%- endfor %}
}
+ {%- else %}
+ {%- for range in subnet.range %}
+ range {{ range.start }} {{ range.stop }};
+ {%- endfor %}
+ {%- endif %}
}
{%- endfor %}
on commit { set shared-networkname = "{{ network.name }}"; }