diff options
author | Linus Lüssing <linus.luessing@web.de> | 2012-10-17 08:53:04 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-10-18 12:14:57 -0400 |
commit | 7f112af40fecf5399b61e69ffc6b55a9d82789f7 (patch) | |
tree | 018c3d158fc6e20eff819ca63f03bc3cb84cc006 /net | |
parent | 43c422eda99b894f18d1cca17bcd2401efaf7bd0 (diff) |
batman-adv: Fix broadcast packet CRC calculation
So far the crc16 checksum for a batman-adv broadcast data packet, received
on a batman-adv hard interface, was calculated over zero bytes of its
content leading to many incoming broadcast data packets wrongly being
dropped (60-80% packet loss).
This patch fixes this issue by calculating the crc16 over the actual,
complete broadcast payload.
The issue is a regression introduced by
("batman-adv: add broadcast duplicate check").
Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Acked-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 8 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 0a9084ad19a6..eebab20c7478 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -1210,8 +1210,8 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | |||
1210 | /** | 1210 | /** |
1211 | * batadv_bla_check_bcast_duplist | 1211 | * batadv_bla_check_bcast_duplist |
1212 | * @bat_priv: the bat priv with all the soft interface information | 1212 | * @bat_priv: the bat priv with all the soft interface information |
1213 | * @bcast_packet: originator mac address | 1213 | * @bcast_packet: encapsulated broadcast frame plus batman header |
1214 | * @hdr_size: maximum length of the frame | 1214 | * @bcast_packet_len: length of encapsulated broadcast frame plus batman header |
1215 | * | 1215 | * |
1216 | * check if it is on our broadcast list. Another gateway might | 1216 | * check if it is on our broadcast list. Another gateway might |
1217 | * have sent the same packet because it is connected to the same backbone, | 1217 | * have sent the same packet because it is connected to the same backbone, |
@@ -1224,14 +1224,14 @@ int batadv_bla_init(struct batadv_priv *bat_priv) | |||
1224 | */ | 1224 | */ |
1225 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, | 1225 | int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv, |
1226 | struct batadv_bcast_packet *bcast_packet, | 1226 | struct batadv_bcast_packet *bcast_packet, |
1227 | int hdr_size) | 1227 | int bcast_packet_len) |
1228 | { | 1228 | { |
1229 | int i, length, curr; | 1229 | int i, length, curr; |
1230 | uint8_t *content; | 1230 | uint8_t *content; |
1231 | uint16_t crc; | 1231 | uint16_t crc; |
1232 | struct batadv_bcast_duplist_entry *entry; | 1232 | struct batadv_bcast_duplist_entry *entry; |
1233 | 1233 | ||
1234 | length = hdr_size - sizeof(*bcast_packet); | 1234 | length = bcast_packet_len - sizeof(*bcast_packet); |
1235 | content = (uint8_t *)bcast_packet; | 1235 | content = (uint8_t *)bcast_packet; |
1236 | content += sizeof(*bcast_packet); | 1236 | content += sizeof(*bcast_packet); |
1237 | 1237 | ||
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 939fc01371df..376b4cc6ca82 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -1124,8 +1124,14 @@ int batadv_recv_bcast_packet(struct sk_buff *skb, | |||
1124 | 1124 | ||
1125 | spin_unlock_bh(&orig_node->bcast_seqno_lock); | 1125 | spin_unlock_bh(&orig_node->bcast_seqno_lock); |
1126 | 1126 | ||
1127 | /* keep skb linear for crc calculation */ | ||
1128 | if (skb_linearize(skb) < 0) | ||
1129 | goto out; | ||
1130 | |||
1131 | bcast_packet = (struct batadv_bcast_packet *)skb->data; | ||
1132 | |||
1127 | /* check whether this has been sent by another originator before */ | 1133 | /* check whether this has been sent by another originator before */ |
1128 | if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size)) | 1134 | if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, skb->len)) |
1129 | goto out; | 1135 | goto out; |
1130 | 1136 | ||
1131 | /* rebroadcast packet */ | 1137 | /* rebroadcast packet */ |