|
@@ -1975,6 +1975,7 @@ static uint32_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
|
|
struct hlist_head *head;
|
|
struct hlist_head *head;
|
|
uint32_t i, crc_tmp, crc = 0;
|
|
uint32_t i, crc_tmp, crc = 0;
|
|
uint8_t flags;
|
|
uint8_t flags;
|
|
|
|
+ __be16 tmp_vid;
|
|
|
|
|
|
for (i = 0; i < hash->size; i++) {
|
|
for (i = 0; i < hash->size; i++) {
|
|
head = &hash->table[i];
|
|
head = &hash->table[i];
|
|
@@ -2011,8 +2012,11 @@ static uint32_t batadv_tt_global_crc(struct batadv_priv *bat_priv,
|
|
orig_node))
|
|
orig_node))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- crc_tmp = crc32c(0, &tt_common->vid,
|
|
|
|
- sizeof(tt_common->vid));
|
|
|
|
|
|
+ /* use network order to read the VID: this ensures that
|
|
|
|
+ * every node reads the bytes in the same order.
|
|
|
|
+ */
|
|
|
|
+ tmp_vid = htons(tt_common->vid);
|
|
|
|
+ crc_tmp = crc32c(0, &tmp_vid, sizeof(tmp_vid));
|
|
|
|
|
|
/* compute the CRC on flags that have to be kept in sync
|
|
/* compute the CRC on flags that have to be kept in sync
|
|
* among nodes
|
|
* among nodes
|
|
@@ -2046,6 +2050,7 @@ static uint32_t batadv_tt_local_crc(struct batadv_priv *bat_priv,
|
|
struct hlist_head *head;
|
|
struct hlist_head *head;
|
|
uint32_t i, crc_tmp, crc = 0;
|
|
uint32_t i, crc_tmp, crc = 0;
|
|
uint8_t flags;
|
|
uint8_t flags;
|
|
|
|
+ __be16 tmp_vid;
|
|
|
|
|
|
for (i = 0; i < hash->size; i++) {
|
|
for (i = 0; i < hash->size; i++) {
|
|
head = &hash->table[i];
|
|
head = &hash->table[i];
|
|
@@ -2064,8 +2069,11 @@ static uint32_t batadv_tt_local_crc(struct batadv_priv *bat_priv,
|
|
if (tt_common->flags & BATADV_TT_CLIENT_NEW)
|
|
if (tt_common->flags & BATADV_TT_CLIENT_NEW)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- crc_tmp = crc32c(0, &tt_common->vid,
|
|
|
|
- sizeof(tt_common->vid));
|
|
|
|
|
|
+ /* use network order to read the VID: this ensures that
|
|
|
|
+ * every node reads the bytes in the same order.
|
|
|
|
+ */
|
|
|
|
+ tmp_vid = htons(tt_common->vid);
|
|
|
|
+ crc_tmp = crc32c(0, &tmp_vid, sizeof(tmp_vid));
|
|
|
|
|
|
/* compute the CRC on flags that have to be kept in sync
|
|
/* compute the CRC on flags that have to be kept in sync
|
|
* among nodes
|
|
* among nodes
|