batman-adv: fix TT CRC computation by ensuring byte order
authorAntonio Quartulli <antonio@open-mesh.com>
Tue, 11 Feb 2014 16:05:06 +0000 (17:05 +0100)
committerAntonio Quartulli <antonio@meshcoding.com>
Mon, 17 Feb 2014 16:17:02 +0000 (17:17 +0100)
commita30e22ca8464c2dc573e0144a972221c2f06c2cd
tree29cf55dd314b3025c8fa759278cbaa7c949753ec
parentb2262df7fcf2c395eca564df83238e931d88d7bf
batman-adv: fix TT CRC computation by ensuring byte order

When computing the CRC on a 2byte variable the order of
the bytes obviously alters the final result. This means
that computing the CRC over the same value on two archs
having different endianess leads to different numbers.

The global and local translation table CRC computation
routine makes this mistake while processing the clients
VIDs. The result is a continuous CRC mismatching between
nodes having different endianess.

Fix this by converting the VID to Network Order before
processing it. This guarantees that every node uses the same
byte order.

Introduced by 7ea7b4a142758deaf46c1af0ca9ceca6dd55138b
("batman-adv: make the TT CRC logic VLAN specific")

Reported-by: Russel Senior <russell@personaltelco.net>
Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
Tested-by: Russell Senior <russell@personaltelco.net>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
net/batman-adv/translation-table.c