On Wed, Apr 24, 2013 at 03:58:56AM +0800, Marek Lindner wrote:
On Tuesday, April 23, 2013 22:34:30 Antonio Quartulli
wrote:
@@ -1535,7 +1535,9 @@ static uint32_t
batadv_tt_global_crc(struct
batadv_priv *bat_priv, orig_node)) continue;
- crc ^= crc32c(0, tt_common->addr, ETH_ALEN);
+ crc_tmp = crc32c(0, &tt_common->vid,
+ sizeof(tt_common->vid));
+ crc ^= crc32c(crc_tmp, tt_common->addr, ETH_ALEN);
}
rcu_read_unlock();
Is it necessary to define another variable ?
yes
Why not:
crc = crc32c(0, &tt_common->vid, sizeof(tt_common->vid));
crc ^= crc32c(crc, tt_common->addr, ETH_ALEN);
because crc_tmp is the result of the CRC operation on the VID and the MAC
address (so one per client), while crc is the container of all the crc_tmp
xor'ed together..
@@ -1565,7 +1567,9 @@ static uint32_t
batadv_tt_local_crc(struct batadv_priv
*bat_priv)
if (tt_common->flags
& BATADV_TT_CLIENT_NEW)
continue;
- crc ^= crc32c(0, tt_common->addr, ETH_ALEN);
+ crc_tmp = crc32c(0, &tt_common->vid,
+ sizeof(tt_common->vid));
+ crc ^= crc32c(crc_tmp, tt_common->addr, ETH_ALEN);
}
Dito.
Idem.
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara