瀏覽代碼

[stp] Fix interpretaton of hello time

Times in STP packets are expressed in units of 1/256 of a second.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 年之前
父節點
當前提交
94dbfb4374
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3
    3
      src/net/stp.c

+ 3
- 3
src/net/stp.c 查看文件

@@ -65,7 +65,7 @@ static int stp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
65 65
 		    const void *ll_source __unused,
66 66
 		    unsigned int flags __unused ) {
67 67
 	struct stp_bpdu *stp;
68
-	unsigned int timeout;
68
+	unsigned int hello;
69 69
 	int rc;
70 70
 
71 71
 	/* Sanity check */
@@ -110,8 +110,8 @@ static int stp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
110 110
 		       "forwarding\n",
111 111
 		       netdev->name, eth_ntoa ( stp->sender.mac ),
112 112
 		       ntohs ( stp->port ), stp->flags );
113
-		timeout = ( ntohs ( stp->hello ) * TICKS_PER_SEC * 2 );
114
-		netdev_link_block ( netdev, timeout );
113
+		hello = ( ( ntohs ( stp->hello ) * TICKS_PER_SEC ) / 256 );
114
+		netdev_link_block ( netdev, ( hello * 2 ) );
115 115
 		rc = -ENETUNREACH;
116 116
 		goto done;
117 117
 	}

Loading…
取消
儲存