summaryrefslogtreecommitdiffstats
path: root/src/net/stp.c
diff options
context:
space:
mode:
authorMichael Brown2015-06-25 18:30:12 +0200
committerMichael Brown2015-06-25 18:32:24 +0200
commit94dbfb43746445e91e775c498db89392313934c7 (patch)
treefea1073ca523bae58f967e04f285b37d46fa3013 /src/net/stp.c
parent[stp] Add support for detecting Spanning Tree Protocol non-forwarding ports (diff)
downloadipxe-94dbfb43746445e91e775c498db89392313934c7.tar.gz
ipxe-94dbfb43746445e91e775c498db89392313934c7.tar.xz
ipxe-94dbfb43746445e91e775c498db89392313934c7.zip
[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>
Diffstat (limited to 'src/net/stp.c')
-rw-r--r--src/net/stp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/net/stp.c b/src/net/stp.c
index cafb6b8e..d4e65a1a 100644
--- a/src/net/stp.c
+++ b/src/net/stp.c
@@ -65,7 +65,7 @@ static int stp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
const void *ll_source __unused,
unsigned int flags __unused ) {
struct stp_bpdu *stp;
- unsigned int timeout;
+ unsigned int hello;
int rc;
/* Sanity check */
@@ -110,8 +110,8 @@ static int stp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
"forwarding\n",
netdev->name, eth_ntoa ( stp->sender.mac ),
ntohs ( stp->port ), stp->flags );
- timeout = ( ntohs ( stp->hello ) * TICKS_PER_SEC * 2 );
- netdev_link_block ( netdev, timeout );
+ hello = ( ( ntohs ( stp->hello ) * TICKS_PER_SEC ) / 256 );
+ netdev_link_block ( netdev, ( hello * 2 ) );
rc = -ENETUNREACH;
goto done;
}