Patchwork bridge: Pseudo-header required for the checksum of ICMP6 header of MLD

login
register
mail settings
Submitter Ang Way Chuang
Date Aug. 24, 2011, 4:56 a.m.
Message ID <4E54846D.10906@sfc.wide.ad.jp>
Download mbox | patch
Permalink /patch/111239/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Ang Way Chuang - Aug. 24, 2011, 4:56 a.m.
Checksum of ICMPv6 is not properly computed because the pseudo header is not used.
Thus, the MLD packet gets dropped by the bridge. This patch fixes the problem for my
testbed. This bug was made visible by commit ff9a57a62afbbe2d0f3a09af321f1fd7645f38a.

This patch has been tested on 3.0.3. Due to lack of understanding on the checksum
optimization and multicast snooping of the kernel stack, can someone please verify the
correctness of this patch?

Signed-off-by: Ang Way Chuang <wcang@sfc.wide.ad.jp>
---
---
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Aug. 24, 2011, 5:06 a.m.
From: Ang Way Chuang <wcang@sfc.wide.ad.jp>
Date: Wed, 24 Aug 2011 13:56:13 +0900

> @@ -1528,9 +1528,12 @@ static int br_multicast_ipv6_rcv(struct
> net_bridge *br,
>              break;
>          /*FALLTHROUGH*/
>      case CHECKSUM_NONE:
> -        skb2->csum = 0;
> -        if (skb_checksum_complete(skb2))
> + if (!skb_csum_unnecessary(skb2) && csum_ipv6_magic(&ip6h->saddr,
> + &ip6h->daddr, skb2->len, IPPROTO_ICMPV6,

Patch has been significantly corrupted by your email client, making
it unusable for us.

Please read linux/Documentation/email-clients.txt, email a test patch
to yourself, and only resend your patch to this list once you can
successfully apply such a patch yourself.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 2d85ca7..bbf361b 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1528,9 +1528,12 @@  static int br_multicast_ipv6_rcv(struct net_bridge *br,
              break;
          /*FALLTHROUGH*/
      case CHECKSUM_NONE:
-        skb2->csum = 0;
-        if (skb_checksum_complete(skb2))
+        if (!skb_csum_unnecessary(skb2) && csum_ipv6_magic(&ip6h->saddr,
+ &ip6h->daddr, skb2->len, IPPROTO_ICMPV6,
+            skb_checksum(skb2, 0, skb2->len, 0))) {
+            err = -EINVAL;
              goto out;
+        }
      }

      err = 0;