Fix support for subnets with only 1 host inside

This commit is contained in:
Maciej Delmanowski 2015-04-13 17:05:11 +02:00
parent 5e25f66fd1
commit 2c517594bf
2 changed files with 11 additions and 1 deletions

View File

@ -9,6 +9,10 @@ v0.1.1
- Make sure that files specified in ``dhcpd_includes`` list exist before the - Make sure that files specified in ``dhcpd_includes`` list exist before the
DHCP server is restarted. [drybjed] DHCP server is restarted. [drybjed]
- Correctly handle IPv4 subnets with only 1 host inside. Previously they were
parsed with errors, now ``debops.dhcpd`` will detect them hand handle
separately from normal networks. [drybjed]
v0.1.0 v0.1.0
------ ------

View File

@ -71,7 +71,13 @@ group {
{% if dhcpd_ipversion is defined and dhcpd_ipversion == '6' %} {% if dhcpd_ipversion is defined and dhcpd_ipversion == '6' %}
subnet6 {{ subnet.subnet | ipaddr('network') + '/' + subnet.subnet | ipaddr('prefix') | string }} { subnet6 {{ subnet.subnet | ipaddr('network') + '/' + subnet.subnet | ipaddr('prefix') | string }} {
{% else %} {% else %}
subnet {{ subnet.subnet | ipaddr('cidr') | ipaddr('network') }} netmask {{ subnet.netmask | default(subnet.subnet | ipaddr('netmask')) }} { {% if (subnet.netmask is defined and (subnet.subnet + '/' + subnet.netmask) | ipaddr('cidr') | ipaddr('network')) %}
subnet {{ (subnet.subnet + '/' + subnet.netmask) | ipaddr('cidr') | ipaddr('network') }} netmask {{ subnet.netmask }} {
{% elif subnet.subnet | ipaddr('cidr') | ipaddr('network') %}
subnet {{ subnet.subnet | ipaddr('cidr') | ipaddr('network') }} netmask {{ subnet.subnet | ipaddr('netmask') }} {
{% else %}
subnet {{ subnet.subnet | ipaddr('cidr') | ipaddr('address') }} netmask 255.255.255.255 {
{% endif %}
{% endif %} {% endif %}
{% if subnet.routers is defined and subnet.routers %} {% if subnet.routers is defined and subnet.routers %}
{% if subnet.routers is string %} {% if subnet.routers is string %}