[ovs-dev] [PATCH 3/3] Multicast Listener Discovery support

Ben Pfaff blp at nicira.com
Thu Jun 25 00:56:24 UTC 2015


On Tue, Jun 23, 2015 at 05:03:16PM -0300, Thadeu Lima de Souza Cascardo wrote:
> Add support for MLDv1 and MLDv2. The behavior is not that different from
> IGMP. Packets to all-hosts address and queries are always flooded,
> reports go to routers, routers are added when a query is observed, and
> all MLD packets go through slow path.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at redhat.com>

Thanks!  This is quite nice.

I think that this ought to update NEWS to mention the new feature.

mld2_record should probably use ovs_16aligned_in6_addr, because corner
cases can cause OVS userspace to process IPv6 packets that are on odd
16-bit boundaries.

OVS coding style calls for {} around the function calls here:

@@ -2073,12 +2106,17 @@ update_mcast_snooping_table(const struct xbridge *xbridge,
             break;
         }
     }
 
     if (!mcast_xbundle || mcast_xbundle != in_xbundle) {
-        update_mcast_snooping_table__(xbridge, flow, ms, flow->igmp_group_ip4,
-                                      vlan, in_xbundle, packet);
+        if (flow->dl_type == htons(ETH_TYPE_IP))
+            update_mcast_snooping_table4__(xbridge, flow, ms,
+                                           flow->igmp_group_ip4, vlan,
+                                           in_xbundle, packet);
+        else
+            update_mcast_snooping_table6__(xbridge, flow, ms, vlan,
+                                           in_xbundle, packet);
     }
     ovs_rwlock_unlock(&ms->rwlock);
 }
 
 /* send the packet to ports having the multicast group learned */

Also here around the assignments:

@ -2328,11 +2384,14 @@ xlate_normal(struct xlate_ctx *ctx)
             }
         }
 
         /* forwarding to group base ports */
         ovs_rwlock_rdlock(&ms->rwlock);
-        grp = mcast_snooping_lookup4(ms, flow->nw_dst, vlan);
+        if (flow->dl_type == htons(ETH_TYPE_IP))
+            grp = mcast_snooping_lookup4(ms, flow->nw_dst, vlan);
+        else if (flow->dl_type == htons(ETH_TYPE_IPV6))
+            grp = mcast_snooping_lookup(ms, &flow->ipv6_dst, vlan);
         if (grp) {
             xlate_normal_mcast_send_group(ctx, ms, grp, in_xbundle, vlan);
             xlate_normal_mcast_send_fports(ctx, ms, in_xbundle, vlan);
             xlate_normal_mcast_send_mrouters(ctx, ms, in_xbundle, vlan);
         } else {

and I see a couple more examples in mcast_snooping_add_mld().

I think the loop in mcast_snooping_add_mld() will loop forever if it
hits an unknown record type.

Also in mcast_snooping_add_mld(), I'd usually either write htons(0) in a
case like this because GCC optimizes it better:
+            if (ntohs(record->nsrcs) == 0

I am looking forward to v2!



More information about the dev mailing list