[netcf-devel] [PATCH 1/1] schema: add delay attribute to bridge element
David Lutterkort
lutter at redhat.com
Thu Jul 16 21:22:29 UTC 2009
On Thu, 2009-07-16 at 22:57 +0300, Dan Kenigsberg wrote:
> On Thu, Jul 16, 2009 at 11:01:00AM -0700, David Lutterkort wrote:
> > diff --git a/data/xml/interface.rng b/data/xml/interface.rng
> > index 93ec9f8..6388d44 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="1">
> > + <start v:serial="2">
> > <choice>
> > <ref name="ethernet-interface"/>
> > <ref name="bridge-interface"/>
> > @@ -115,6 +115,10 @@
> > <ref name="on-or-off"/>
> > </attribute>
> > </optional>
> > + <!-- Bridge forward delay (see 'brctl setfd') -->
> > + <optional v:since="2">
> > + <attribute name="delay"><ref name="uint"/></attribute>
> > + </optional>
>
> brctl setfd supports microsecond-precision timeval; uint sounds wrong
> for that.
Nice catch - the man page talks about setting it in seconds, without
mentioning that internally, brctl converts the argument with
sscanf(time, "%lf", &secs)
and sticks it into a 'struct timeval'.
I fixed that with the incremental patch below; it would be nice to
narrow the data type down further, but (a) brctl setfd br0 1e-10 works
just fine and (b) would break the initscripts -> interface XML
direction, in that it would be easy to write an ifcfg-br0 whose
interface XML is not valid.
David
diff --git a/data/xml/interface.rng b/data/xml/interface.rng
index 6388d44..dc367f3 100644
--- a/data/xml/interface.rng
+++ b/data/xml/interface.rng
@@ -117,7 +117,7 @@
</optional>
<!-- Bridge forward delay (see 'brctl setfd') -->
<optional v:since="2">
- <attribute name="delay"><ref name="uint"/></attribute>
+ <attribute name="delay"><ref name="timeval"/></attribute>
</optional>
<oneOrMore>
<choice>
@@ -352,6 +352,12 @@
</data>
</define>
+ <define name="timeval">
+ <data type="double">
+ <param name="minInclusive">0</param>
+ </data>
+ </define>
+
<define name='device-name'>
<data type='string'>
<param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
diff --git a/tests/initscripts/bridge.xml b/tests/initscripts/bridge.xml
index 5734315..d49313f 100644
--- a/tests/initscripts/bridge.xml
+++ b/tests/initscripts/bridge.xml
@@ -10,7 +10,7 @@
<node label="TYPE" value="Bridge"/>
<node label="BOOTPROTO" value="dhcp"/>
<node label="STP" value="off"/>
- <node label="DELAY" value="0"/>
+ <node label="DELAY" value="0.01"/>
</tree>
<tree path="/files/etc/sysconfig/network-scripts/ifcfg-eth0">
<node label="DEVICE" value="eth0"/>
diff --git a/tests/interface/bridge.xml b/tests/interface/bridge.xml
index c04e24a..bf084d4 100644
--- a/tests/interface/bridge.xml
+++ b/tests/interface/bridge.xml
@@ -4,7 +4,7 @@
<protocol family="ipv4">
<dhcp/>
</protocol>
- <bridge stp="off" delay="0">
+ <bridge stp="off" delay="0.01">
<interface type="ethernet" name="eth0">
<mac address="ab:bb:cc:dd:ee:ff"/>
</interface>
More information about the netcf-devel
mailing list