mirror of
https://github.com/ipxe/ipxe
synced 2025-12-14 16:01:38 +03:00
[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>
This commit is contained in:
@@ -65,7 +65,7 @@ static int stp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
|
|||||||
const void *ll_source __unused,
|
const void *ll_source __unused,
|
||||||
unsigned int flags __unused ) {
|
unsigned int flags __unused ) {
|
||||||
struct stp_bpdu *stp;
|
struct stp_bpdu *stp;
|
||||||
unsigned int timeout;
|
unsigned int hello;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
@@ -110,8 +110,8 @@ static int stp_rx ( struct io_buffer *iobuf, struct net_device *netdev,
|
|||||||
"forwarding\n",
|
"forwarding\n",
|
||||||
netdev->name, eth_ntoa ( stp->sender.mac ),
|
netdev->name, eth_ntoa ( stp->sender.mac ),
|
||||||
ntohs ( stp->port ), stp->flags );
|
ntohs ( stp->port ), stp->flags );
|
||||||
timeout = ( ntohs ( stp->hello ) * TICKS_PER_SEC * 2 );
|
hello = ( ( ntohs ( stp->hello ) * TICKS_PER_SEC ) / 256 );
|
||||||
netdev_link_block ( netdev, timeout );
|
netdev_link_block ( netdev, ( hello * 2 ) );
|
||||||
rc = -ENETUNREACH;
|
rc = -ENETUNREACH;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user