提交 f3d08aa0 编写于 作者: R Roman Bogorodskiy 提交者: Daniel P. Berrange

Fix units in virNetDevBridgeSetSTPDelay on BSD

virNetDevBridgeSetSTPDelay accepts delay in milliseconds,
but BSD implementation was expecting seconds. Therefore,
it was working correctly only with delay == 0.
上级 0c737dfb
...@@ -593,10 +593,11 @@ int virNetDevBridgeSetSTPDelay(const char *brname, ...@@ -593,10 +593,11 @@ int virNetDevBridgeSetSTPDelay(const char *brname,
int delay) int delay)
{ {
struct ifbrparam param; struct ifbrparam param;
u_long delay_seconds = delay / 1000;
/* FreeBSD doesn't allow setting STP delay < 4 */ /* FreeBSD doesn't allow setting STP delay < 4 */
delay = delay < 4 ? 4 : delay; delay_seconds = delay_seconds < 4 ? 4 : delay_seconds;
param.ifbrp_fwddelay = ((u_long)delay) & 0xff; param.ifbrp_fwddelay = delay_seconds & 0xff;
if (virNetDevBridgeCmd(brname, BRDGSFD, &param, sizeof(param)) < 0) { if (virNetDevBridgeCmd(brname, BRDGSFD, &param, sizeof(param)) < 0) {
virReportSystemError(errno, virReportSystemError(errno,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册