* [B.A.T.M.A.N.] [PATCH stable 3.5] batman-adv: Fix broadcast packet CRC calculation
@ 2012-11-03 20:55 Antonio Quartulli
2012-11-04 1:05 ` [B.A.T.M.A.N.] [PATCHv2 " Antonio Quartulli
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2012-11-03 20:55 UTC (permalink / raw)
To: stable; +Cc: b.a.t.m.a.n, Marek Lindner
From: Linus Lüssing <linus.luessing@web.de>
commit 7f112af40fecf5399b61e69ffc6b55a9d82789f7 upstream.
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>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
net/batman-adv/bridge_loop_avoidance.c | 16 +++++++---------
net/batman-adv/routing.c | 8 +++++++-
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index c5863f4..740bb6f 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1172,8 +1172,8 @@ int bla_init(struct bat_priv *bat_priv)
/**
* @bat_priv: the bat priv with all the soft interface information
- * @bcast_packet: originator mac address
- * @hdr_size: maximum length of the frame
+ * @bcast_packet: encapsulated broadcast frame plus batman header
+ * @bcast_packet_len: length of encapsulated broadcast frame plus batman header
*
* check if it is on our broadcast list. Another gateway might
* have sent the same packet because it is connected to the same backbone,
@@ -1183,19 +1183,17 @@ int bla_init(struct bat_priv *bat_priv)
* with a good chance that it is the same packet. If it is furthermore
* sent by another host, drop it. We allow equal packets from
* the same host however as this might be intended.
- *
- **/
-
-int bla_check_bcast_duplist(struct bat_priv *bat_priv,
- struct bcast_packet *bcast_packet,
- int hdr_size)
+ */
+int batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
+ struct batadv_bcast_packet *bcast_packet,
+ int bcast_packet_len)
{
int i, length, curr;
uint8_t *content;
uint16_t crc;
struct bcast_duplist_entry *entry;
- length = hdr_size - sizeof(*bcast_packet);
+ length = bcast_packet_len - sizeof(*bcast_packet);
content = (uint8_t *)bcast_packet;
content += sizeof(*bcast_packet);
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 015471d..0c2cb6b 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1081,8 +1081,14 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
spin_unlock_bh(&orig_node->bcast_seqno_lock);
+ /* keep skb linear for crc calculation */
+ if (skb_linearize(skb) < 0)
+ goto out;
+
+ bcast_packet = (struct batadv_bcast_packet *)skb->data;
+
/* check whether this has been sent by another originator before */
- if (bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size))
+ if (batadv_bla_check_bcast_duplist(bat_priv, bcast_packet, skb->len))
goto out;
/* rebroadcast packet */
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [B.A.T.M.A.N.] [PATCHv2 stable 3.5] batman-adv: Fix broadcast packet CRC calculation
2012-11-03 20:55 [B.A.T.M.A.N.] [PATCH stable 3.5] batman-adv: Fix broadcast packet CRC calculation Antonio Quartulli
@ 2012-11-04 1:05 ` Antonio Quartulli
2012-11-05 8:15 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2012-11-04 1:05 UTC (permalink / raw)
To: stable; +Cc: b.a.t.m.a.n, Marek Lindner
From: Linus Lüssing <linus.luessing@web.de>
commit 7f112af40fecf5399b61e69ffc6b55a9d82789f7 upstream.
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>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
Sorry, but I made a mistake in backporting the patch to 3.5. Now it's ok.
Thanks,
net/batman-adv/bridge_loop_avoidance.c | 12 +++++-------
net/batman-adv/routing.c | 8 +++++++-
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index c5863f4..87a6235 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -1172,8 +1172,8 @@ int bla_init(struct bat_priv *bat_priv)
/**
* @bat_priv: the bat priv with all the soft interface information
- * @bcast_packet: originator mac address
- * @hdr_size: maximum length of the frame
+ * @bcast_packet: encapsulated broadcast frame plus batman header
+ * @bcast_packet_len: length of encapsulated broadcast frame plus batman header
*
* check if it is on our broadcast list. Another gateway might
* have sent the same packet because it is connected to the same backbone,
@@ -1183,19 +1183,17 @@ int bla_init(struct bat_priv *bat_priv)
* with a good chance that it is the same packet. If it is furthermore
* sent by another host, drop it. We allow equal packets from
* the same host however as this might be intended.
- *
- **/
-
+ */
int bla_check_bcast_duplist(struct bat_priv *bat_priv,
struct bcast_packet *bcast_packet,
- int hdr_size)
+ int bcast_packet_len)
{
int i, length, curr;
uint8_t *content;
uint16_t crc;
struct bcast_duplist_entry *entry;
- length = hdr_size - sizeof(*bcast_packet);
+ length = bcast_packet_len - sizeof(*bcast_packet);
content = (uint8_t *)bcast_packet;
content += sizeof(*bcast_packet);
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 015471d..af40ca3 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1081,8 +1081,14 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
spin_unlock_bh(&orig_node->bcast_seqno_lock);
+ /* keep skb linear for crc calculation */
+ if (skb_linearize(skb) < 0)
+ goto out;
+
+ bcast_packet = (struct bcast_packet *)skb->data;
+
/* check whether this has been sent by another originator before */
- if (bla_check_bcast_duplist(bat_priv, bcast_packet, hdr_size))
+ if (bla_check_bcast_duplist(bat_priv, bcast_packet, skb->len))
goto out;
/* rebroadcast packet */
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCHv2 stable 3.5] batman-adv: Fix broadcast packet CRC calculation
2012-11-04 1:05 ` [B.A.T.M.A.N.] [PATCHv2 " Antonio Quartulli
@ 2012-11-05 8:15 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2012-11-05 8:15 UTC (permalink / raw)
To: Antonio Quartulli; +Cc: b.a.t.m.a.n, Marek Lindner, stable
On Sun, Nov 04, 2012 at 02:05:27AM +0100, Antonio Quartulli wrote:
> From: Linus Lüssing <linus.luessing@web.de>
>
> commit 7f112af40fecf5399b61e69ffc6b55a9d82789f7 upstream.
>
> 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>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
>
> Sorry, but I made a mistake in backporting the patch to 3.5. Now it's ok.
> Thanks,
3.5 is end-of-life, so I can't take any patches for it anymore, sorry.
In the future, take a look at the front page of www.kernel.org, it shows
what trees are still "alive" and which are end-of-life.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-05 8:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-03 20:55 [B.A.T.M.A.N.] [PATCH stable 3.5] batman-adv: Fix broadcast packet CRC calculation Antonio Quartulli
2012-11-04 1:05 ` [B.A.T.M.A.N.] [PATCHv2 " Antonio Quartulli
2012-11-05 8:15 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox