mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Do a better job of validating IP and MAC addresses in network.rng
IP addresses and MAC addresses had been defined in the RNG simply as <text/> meaning that, according to the RNG, any string could go in there. Of course the C parsing code does a much better job of validating, but we may as well have this describing the contents accurately (even though it's currently only used during "make check").
This commit is contained in:
parent
5983f2d297
commit
7665440956
@ -83,14 +83,12 @@
|
||||
<optional>
|
||||
<!-- The IP element sets up NAT'ing and an optional DHCP server
|
||||
local to the host. -->
|
||||
<!-- FIXME: address, netmask and the start and end of the ranges
|
||||
are IP addresses, and should be validated as such in the scheme -->
|
||||
<element name="ip">
|
||||
<optional>
|
||||
<attribute name="address"><text/></attribute>
|
||||
<attribute name="address"><ref name="ipv4-addr"/></attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="netmask"><text/></attribute>
|
||||
<attribute name="netmask"><ref name="ipv4-addr"/></attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="tftp">
|
||||
@ -102,13 +100,13 @@
|
||||
<element name="dhcp">
|
||||
<zeroOrMore>
|
||||
<element name="range">
|
||||
<attribute name="start"><text/></attribute>
|
||||
<attribute name="end"><text/></attribute>
|
||||
<attribute name="start"><ref name="ipv4-addr"/></attribute>
|
||||
<attribute name="end"><ref name="ipv4-addr"/></attribute>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<element name="host">
|
||||
<attribute name="mac"><text/></attribute>
|
||||
<attribute name="mac"><ref name="mac-addr"/></attribute>
|
||||
<attribute name="name"><text/></attribute>
|
||||
<attribute name="ip"><text/></attribute>
|
||||
</element>
|
||||
@ -127,4 +125,19 @@
|
||||
</interleave>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!-- An ipv4 "dotted quad" address -->
|
||||
<define name='ipv4-addr'>
|
||||
<data type='string'>
|
||||
<param name="pattern">(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([1-9][0-9])|([0-9]))</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
<!-- a 6 byte MAC address in ASCII-hex format, eg "12:34:56:78:9A:BC" -->
|
||||
<define name='mac-addr'>
|
||||
<data type='string'>
|
||||
<param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
|
||||
</data>
|
||||
</define>
|
||||
|
||||
</grammar>
|
||||
|
Loading…
Reference in New Issue
Block a user