]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix units in virNetDevBridgeSetSTPDelay on BSD
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Tue, 25 Jun 2013 10:49:34 +0000 (11:49 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 25 Jun 2013 12:13:46 +0000 (13:13 +0100)
virNetDevBridgeSetSTPDelay accepts delay in milliseconds,
but BSD implementation was expecting seconds. Therefore,
it was working correctly only with delay == 0.

src/util/virnetdevbridge.c

index ffcb4a4facbbd3b9d64f798b975c4a4266f9fc4d..9d95374a0ab83add2e58305fa637e4dcceb9ab0f 100644 (file)
@@ -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,