From 93f6b6a3b23f4169a4af4a23eb795d041be84e42 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 4 Sep 2018 06:28:38 +0200 Subject: 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. ------ 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. ------ --- src/conf_mode/dhcp_server.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') 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 }}"; } -- cgit v1.2.3