Przeglądaj źródła

[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 lat temu
rodzic
commit
94dbfb4374
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3
    3
      src/net/stp.c

+ 3
- 3
src/net/stp.c Wyświetl plik

@@ -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
 	}

Ładowanie…
Anuluj
Zapisz