conf: Add <lease/> option for <dhcp/> settings

If an user is trying to configure a dhcp neetwork settings, it is not
possible to change the leasetime of a range or a host entry. This is
available using dnsmasq extra options, but they are associated with
dhcp-range or dhcp-hosts fields. This patch implements a leasetime for
range and hosts tags. They can be defined under that settings:

    <dhcp>
      <range ...>
        <lease/>
      </range>
      <host ...>
        <lease/>
      </host>
    </dhcp>

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=913446

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Julio Faracco
2020-04-22 17:05:57 -03:00
committed by Michal Privoznik
parent 5670fb5794
commit 97a0aa2467
12 changed files with 313 additions and 64 deletions

View File

@@ -607,4 +607,12 @@
</element>
</define>
<define name="leaseUnit">
<choice>
<value>seconds</value>
<value>minutes</value>
<value>hours</value>
</choice>
</define>
</grammar>

View File

@@ -371,6 +371,16 @@
<element name="range">
<attribute name="start"><ref name="ipAddr"/></attribute>
<attribute name="end"><ref name="ipAddr"/></attribute>
<interleave>
<optional>
<element name="lease">
<attribute name="expiry"><ref name="unsignedLong"/></attribute>
<optional>
<attribute name="unit"><ref name="leaseUnit"/></attribute>
</optional>
</element>
</optional>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
@@ -388,6 +398,16 @@
<attribute name="name"><text/></attribute>
</choice>
<attribute name="ip"><ref name="ipAddr"/></attribute>
<interleave>
<optional>
<element name="lease">
<attribute name="expiry"><ref name="unsignedLong"/></attribute>
<optional>
<attribute name="unit"><ref name="leaseUnit"/></attribute>
</optional>
</element>
</optional>
</interleave>
</element>
</zeroOrMore>
<optional>