[libvirt] [PATCH] bugfix: virNetDevBridgeSetSTPDelay on BSD

Roman Bogorodskiy bogorodskiy at gmail.com
Mon Jun 24 13:52:18 UTC 2013


  Daniel P. Berrange wrote:

> On Sat, Jun 22, 2013 at 06:01:17PM +0400, Roman Bogorodskiy wrote:
> > virNetDevBridgeSetSTPDelay accepts delay in milliseconds,
> > but BSD implementation was expecting seconds. Therefore,
> > it was working correctly only with delay == 0.
> > ---
> >  src/util/virnetdevbridge.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
> > index ffcb4a4..9d95374 100644
> > --- a/src/util/virnetdevbridge.c
> > +++ b/src/util/virnetdevbridge.c
> > @@ -593,10 +593,11 @@ int virNetDevBridgeSetSTPDelay(const char *brname,
> >                                 int delay)
> >  {
> >      struct ifbrparam param;
> > +    u_long delay_seconds = delay / 1000;
> >  
> >      /* FreeBSD doesn't allow setting STP delay < 4 */
> > -    delay = delay < 4 ? 4 : delay;
> > -    param.ifbrp_fwddelay = ((u_long)delay) & 0xff;
> > +    delay_seconds = delay_seconds < 4 ? 4 : delay_seconds;
> > +    param.ifbrp_fwddelay = delay_seconds & 0xff;
> >  
> >      if (virNetDevBridgeCmd(brname, BRDGSFD, &param, sizeof(param)) < 0) {
> >          virReportSystemError(errno,
> 
> ACK.
> 
> 
> Does FreeBSD really not allow setting a delay less than 4 seconds ?
> That would make PXE boot fairly unreliable, because QEMU will start
> and iPXE will run significantly before that 4 second network delay
> has expired causing the PXE packets to be lost.

Yes, it doesn't. Quoting ifconfig(8):

fwddelay seconds
  Set the time that must pass before an interface begins
  forwarding packets when Spanning Tree is enabled.  The default
  is 15 seconds.  The minimum is 4 seconds and the maximum is 30 seconds.

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130624/c477e7b7/attachment-0001.sig>


More information about the libvir-list mailing list