Sfoglia il codice sorgente

[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 anni fa
parent
commit
94dbfb4374
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3
    3
      src/net/stp.c

+ 3
- 3
src/net/stp.c Vedi File

@@ -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…
Annulla
Salva