[netcf-devel] [PATCH 1/3] Extend the schema for IPv6 addressing

Daniel P. Berrange berrange at redhat.com
Fri Sep 25 15:53:26 UTC 2009


On Fri, Sep 25, 2009 at 05:48:52PM +0200, Daniel Veillard wrote:
> On Thu, Sep 24, 2009 at 04:32:21PM -0700, David Lutterkort wrote:
> > ---
> >  data/xml/interface.rng |   53 +++++++++++++++++++++++++++++++++++++++++++++++-
> >  1 files changed, 52 insertions(+), 1 deletions(-)
> > 
> > diff --git a/data/xml/interface.rng b/data/xml/interface.rng
> > index 6b8f79d..bb8500f 100644
> > --- a/data/xml/interface.rng
> > +++ b/data/xml/interface.rng
> > @@ -7,7 +7,7 @@
> >         is released. The current version is indicated with the v:serial
> >         attribute on the start element.
> >    -->
> > -  <start v:serial="2">
> > +  <start v:serial="3">
> >      <choice>
> >        <ref name="ethernet-interface"/>
> >        <ref name="bridge-interface"/>
> > @@ -276,6 +276,11 @@
> >          <ref name="protocol-ipv4"/>
> >        </element>
> >      </optional>
> > +    <optional v:since="3">
> > +      <element name="protocol">
> > +        <ref name="protocol-ipv6"/>
> > +      </element>
> > +    </optional>
> >    </define>
> 
>   Hum, this forces ipv4 protocol info before ipv6 ones, but I guess it's
> fine, makes things easier to lookup manually though I guess the parsing
> code doesn't care :-)
> 
> >    <define name="protocol-ipv4">
> > @@ -305,6 +310,38 @@
> >        </group>
> >      </choice>
> >    </define>
> > +
> > +  <define name="protocol-ipv6">
> > +    <attribute name="family">
> > +      <value>ipv6</value>
> > +    </attribute>
> > +    <optional>
> > +      <element name="autoconf"><empty/></element>
> > +    </optional>
> > +    <optional>
> 
>   ----------
> > +      <element name="dhcp">
> > +        <optional>
> > +          <attribute name="peerdns">
> > +            <ref name="yes-or-no"/>
> > +          </attribute>
> > +        </optional>
> > +      </element>
>   ----------
> 
>   identical to ipv4, so I would factor this out as a define.
> 
> > +    </optional>
> > +    <zeroOrMore>
> > +      <element name="ip">
> > +        <attribute name="address"><ref name="ipv6-addr"/></attribute>
> > +        <optional>
> > +          <attribute name="prefix"><ref name="ipv6-prefix"/></attribute>
> > +        </optional>
> > +      </element>
> > +    </zeroOrMore>
> > +    <optional>
> > +      <element name="route">
> > +        <attribute name="gateway"><ref name="ipv6-addr"/></attribute>
> > +      </element>
> > +    </optional>
> > +  </define>
> > +
> 
>  ACK
> 
> >         following additions to DHCP:
> >  
> > @@ -402,6 +439,20 @@
> >      </data>
> >    </define>
> >  
> > +  <!-- Based on http://blog.mes-stats.fr/2008/10/09/regex-ipv4-et-ipv6 -->
> > +  <define name='ipv6-addr'>
> > +    <data type='string'>
> > +      <!-- To understand this better, take apart the toplevel '|'s -->
> > +      <param name="pattern">(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))))|(([0-9A-Fa-f]{1,4}:){0,5}:((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))))|(::([0-9A-Fa-f]{1,4}:){0,5}((((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2})))\.){3}(((25[0-5])|(1[0-9]{2})|(2[0-4][0-9])|([0-9]{1,2}))))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:)</param>
> 
>  OMG !!!
> Well as long as it doesn't break libxml2 regexps :-)
> 
> > +    </data>
> > +  </define>
> > +
> > +  <define name='ipv6-prefix'>
> > +    <data type='unsignedInt'>
> > +      <param name="maxInclusive">128</param>
> > +    </data>
> > +  </define>
> > +
> >    <define name='vlan-id'>
> >      <data type="unsignedInt">
> >        <param name="maxInclusive">4096</param>
> 
>   I think the only novelty is the zeroOrMore for <ip> which sounds fine
> from an Ipv6 standpoint !

It is not really a novelty - the IPv4 definition should be allowing
zeroOrMore too - it is a bug that it doesn't !

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


More information about the netcf-devel mailing list