From patchwork Wed Dec 12 05:10:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Herton Ronaldo Krzesinski X-Patchwork-Id: 205398 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id B16EF2C032A for ; Wed, 12 Dec 2012 16:10:56 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tiean-0005JE-AJ; Wed, 12 Dec 2012 05:10:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Tieac-0005D4-9X for kernel-team@lists.ubuntu.com; Wed, 12 Dec 2012 05:10:39 +0000 Received: from [186.212.210.63] (helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Tieab-0007bD-EB; Wed, 12 Dec 2012 05:10:38 +0000 From: Herton Ronaldo Krzesinski To: =?UTF-8?q?Linus=20L=C3=BCssing?= Subject: =?UTF-8?q?=5B=203=2E5=2Ey=2Ez=20extended=20stable=20=5D=20Patch=20=22batman-adv=3A=20Fix=20broadcast=20packet=20CRC=20calculation=22=20has=20been=20added=20to=20staging=20queue?= Date: Wed, 12 Dec 2012 03:10:33 -0200 Message-Id: <1355289033-30495-1-git-send-email-herton.krzesinski@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-Extended-Stable: 3.5 MIME-Version: 1.0 Cc: kernel-team@lists.ubuntu.com, Marek Lindner , Simon Wunderlich X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com This is a note to let you know that I have just added a patch titled batman-adv: Fix broadcast packet CRC calculation to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Herton ------ From 9388cc97051d93456cd1ea486894d0f00d0f3197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Wed, 17 Oct 2012 14:53:04 +0200 Subject: [PATCH] batman-adv: Fix broadcast packet CRC calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Simon Wunderlich Signed-off-by: Marek Lindner [ herton: use backported version provided on stable mailing list, but drop unrelated comment change ] Signed-off-by: Herton Ronaldo Krzesinski --- net/batman-adv/bridge_loop_avoidance.c | 8 ++++---- net/batman-adv/routing.c | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) -- 1.7.9.5 diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index c5863f4..2531044 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, @@ -1188,14 +1188,14 @@ int bla_init(struct bat_priv *bat_priv) 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 */