]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[stp] Fix interpretaton of hello time
authorMichael Brown <mcb30@ipxe.org>
Thu, 25 Jun 2015 16:30:12 +0000 (17:30 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 25 Jun 2015 16:32:24 +0000 (17:32 +0100)
Times in STP packets are expressed in units of 1/256 of a second.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/stp.c

index cafb6b8ee4857b1226f900d46f37ff503b08afba..d4e65a1a2ad93f45fecc2dfb6e067b4428cba540 100644 (file)
@@ -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;
        }