[libvirt] PATCH: Fix setting of bridge forward-delay

Daniel P. Berrange berrange at redhat.com
Fri Aug 1 10:46:59 UTC 2008


The libvirt virtual networking  allows setting of the forward-delay
parameter. This is the delay the kernel inserts before it starts
forwarding traffic when a guest VIF is added to a bridge. The default
network config sets this to zero, and previously we had a bug where
we accidentally called brSetForwardDelay() based on the STP parameter
which was zero, so we did in fact have a forward delay of 0 as desired.

Rich then fixed this bug, and thus we no longer accidentally call the
brSetForardDelay() method. Unfortuntely the place where we *do* delibrately
call it is conditionalized on

 if (network->def->delay


So if you set a forward delay of zero, we never explicitly set this on
the bridge. Thus the kernel's default setting applies which is 15 seconds.

The fix is trivial - just remove the  conditional.

So previously you could see traffic forwaarding delayed by the kernel
for 30 seconds

Aug  1 11:34:16 t60wlan kernel: device vnet0 entered promiscuous mode
Aug  1 11:34:16 t60wlan kernel: virbr0: port 1(vnet0) entering listening state
Aug  1 11:34:31 t60wlan kernel: virbr0: port 1(vnet0) entering learning state
Aug  1 11:34:46 t60wlan kernel: virbr0: topology change detected, propagating
Aug  1 11:34:46 t60wlan kernel: virbr0: port 1(vnet0) entering forwarding state

Now it applies immediately

Aug  1 11:40:07 t60wlan kernel: device vnet0 entered promiscuous mode
Aug  1 11:40:07 t60wlan kernel: virbr0: port 1(vnet0) entering listening state
Aug  1 11:40:07 t60wlan kernel: virbr0: port 1(vnet0) entering learning state
Aug  1 11:40:07 t60wlan kernel: virbr0: topology change detected, propagating
Aug  1 11:40:07 t60wlan kernel: virbr0: port 1(vnet0) entering forwarding state

Daniel

Index: src/qemu_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
retrieving revision 1.98
diff -u -r1.98 qemu_driver.c
--- src/qemu_driver.c	30 Jul 2008 09:20:19 -0000	1.98
+++ src/qemu_driver.c	1 Aug 2008 10:46:36 -0000
@@ -1480,8 +1480,7 @@
     }
 
 
-    if (network->def->delay &&
-        (err = brSetForwardDelay(driver->brctl, network->def->bridge, network->def->delay))) {
+    if ((err = brSetForwardDelay(driver->brctl, network->def->bridge, network->def->delay))) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          _("failed to set bridge forward delay to %ld"),
                          network->def->delay);


-- 
|: 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 libvir-list mailing list