On Wed, Dec 14, 2016 at 07:08:27PM +0100, Eelco Chaudron wrote:
> When IGMP or MLD packets arrive their content is used without the checksum
> being verified. With this change the checksum is verified, and the packet
> is not used for multicast snooping on failure.
> 
> Signed-off-by: Eelco Chaudron <echau...@redhat.com>

Thanks for the patch!  I applied it to master.  I folded in the
following simplification, which I believe to be correct and also passes
the test.  Please let me know if you see a problem.

Also, I believe that this is your first contribution to Open vSwitch.
Thank you for helping, and welcome to the team!

diff --git a/lib/packets.c b/lib/packets.c
index 8075dda..fbc6e09 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -1485,16 +1485,8 @@ packet_csum_upperlayer6(const struct 
ovs_16aligned_ip6_hdr *ip6,
 {
     uint32_t partial = 0;
 
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_src.be32[0])));
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_src.be32[1])));
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_src.be32[2])));
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_src.be32[3])));
-
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_dst.be32[0])));
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_dst.be32[1])));
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_dst.be32[2])));
-    partial = csum_add32(partial, get_16aligned_be32(&(ip6->ip6_dst.be32[3])));
-
+    partial = csum_continue(partial, &ip6->ip6_src, sizeof ip6->ip6_src);
+    partial = csum_continue(partial, &ip6->ip6_dst, sizeof ip6->ip6_dst);
     partial = csum_add16(partial, htons(l4_protocol));
     partial = csum_add16(partial, htons(l4_size));
 
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to