<div dir="ltr">It is useful, yes; and posting diffs on the mailing list is not the way to get them reviewed and approved.  If you can get this on gerrit it will get a proper review, and I would certainly like to see something like this incorporated.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 21 July 2015 at 15:41, John Nielsen <span dir="ltr"><<a href="mailto:lists@jnielsen.net" target="_blank">lists@jnielsen.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I may be in a small minority since I a) use VXLAN, b) don’t hate multicast and c) use linuxbridge instead of OVS. However I thought I’d share this patch in case I’m not alone.<br>
<br>
If you assume the use of multicast, VXLAN works quite nicely to isolate L2 domains AND to prevent delivery of unwanted broadcast/unknown/multicast packets to VTEPs that don’t need them. However, the latter only holds up if each VXLAN VNI uses its own unique multicast group address. Currently, you have to either disable multicast (and use l2_population or similar) or use only a single group address for ALL VNIs (and force every single VTEP to receive every BUM packet from every network). For my usage, this patch seems simpler.<br>
<br>
Feedback is very welcome. In particular I’d like to know if anyone else finds this useful and if so, what (if any) changes might be required to get it committed. Thanks!<br>
<br>
JN<br>
<br>
<br>
commit 17c32a9ad07911f3b4148e96cbcae88720eef322<br>
Author: John Nielsen <<a href="mailto:john@jnielsen.net">john@jnielsen.net</a>><br>
Date:   Tue Jul 21 16:13:42 2015 -0600<br>
<br>
    Add a boolean option, vxlan_group_auto, which if enabled will compute<br>
    a unique multicast group address group for each VXLAN VNI. Since VNIs<br>
    are 24 bits, they map nicely to the <a href="http://239.0.0.0/8" rel="noreferrer" target="_blank">239.0.0.0/8</a> "site-local" multicast<br>
    range. Eight bits of the VNI are used for the second, third and fourth<br>
    octets (with 239 always as the first octet).<br>
<br>
    Using this option allows VTEPs to receive BUM datagrams via multicast,<br>
    but only for those VNIs in which they participate. In other words, it is<br>
    an alternative to the l2_population extension and driver for environments<br>
    where both multicast and linuxbridge are used.<br>
<br>
    If the option is True then multicast groups are computed as described<br>
    above. If the option is False then the previous behavior is used<br>
    (either a single multicast group is defined by vxlan_group or multicast<br>
    is disabled).<br>
<br>
diff --git a/etc/neutron/plugins/ml2/linuxbridge_agent.ini b/etc/neutron/plugins/ml2/linuxbridge_agent.ini<br>
index d1a01ba..03578ad 100644<br>
--- a/etc/neutron/plugins/ml2/linuxbridge_agent.ini<br>
+++ b/etc/neutron/plugins/ml2/linuxbridge_agent.ini<br>
@@ -25,6 +25,10 @@<br>
 # This group must be the same on all the agents.<br>
 # vxlan_group = 224.0.0.1<br>
 #<br>
+# (BoolOpt) Derive a unique 239.x.x.x multicast group for each vxlan VNI.<br>
+# If this option is true, the setting of vxlan_group is ignored.<br>
+# vxlan_group_auto = False<br>
+#<br>
 # (StrOpt) Local IP address to use for VXLAN endpoints (required)<br>
 # local_ip =<br>
 #<br>
diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/common/config.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/common/config.py<br>
index 6f15236..b4805d5 100644<br>
--- a/neutron/plugins/ml2/drivers/linuxbridge/agent/common/config.py<br>
+++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/common/config.py<br>
@@ -31,6 +31,9 @@ vxlan_opts = [<br>
                help=_("TOS for vxlan interface protocol packets.")),<br>
     cfg.StrOpt('vxlan_group', default=DEFAULT_VXLAN_GROUP,<br>
                help=_("Multicast group for vxlan interface.")),<br>
+    cfg.BoolOpt('vxlan_group_auto', default=False,<br>
+                help=_("Derive a unique 239.x.x.x multicast group for each "<br>
+                       "vxlan VNI")),<br>
     cfg.IPOpt('local_ip', version=4,<br>
               help=_("Local IP address of the VXLAN endpoints.")),<br>
     cfg.BoolOpt('l2_population', default=False,<br>
diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py<br>
index 61627eb..a0efde1 100644<br>
--- a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py<br>
+++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py<br>
@@ -127,6 +127,14 @@ class LinuxBridgeManager(object):<br>
             LOG.warning(_LW("Invalid Segmentation ID: %s, will lead to "<br>
                             "incorrect vxlan device name"), segmentation_id)<br>
<br>
+    def get_vxlan_group(self, segmentation_id):<br>
+        if cfg.CONF.VXLAN.vxlan_group_auto:<br>
+            return ("239." +<br>
+                    str(segmentation_id >> 16) + "." +<br>
+                    str(segmentation_id >> 8 % 256) + "." +<br>
+                    str(segmentation_id % 256))<br>
+        return cfg.CONF.VXLAN.vxlan_group<br>
+<br>
     def get_all_neutron_bridges(self):<br>
         neutron_bridge_list = []<br>
         bridge_list = os.listdir(BRIDGE_FS)<br>
@@ -240,7 +248,7 @@ class LinuxBridgeManager(object):<br>
                        'segmentation_id': segmentation_id})<br>
             args = {'dev': self.local_int}<br>
             if self.vxlan_mode == lconst.VXLAN_MCAST:<br>
-                args['group'] = cfg.CONF.VXLAN.vxlan_group<br>
+                args['group'] = self.get_vxlan_group(segmentation_id)<br>
             if cfg.CONF.VXLAN.ttl:<br>
                 args['ttl'] = cfg.CONF.VXLAN.ttl<br>
             if cfg.CONF.VXLAN.tos:<br>
@@ -553,9 +561,10 @@ class LinuxBridgeManager(object):<br>
             self.delete_vxlan(test_iface)<br>
<br>
     def vxlan_mcast_supported(self):<br>
-        if not cfg.CONF.VXLAN.vxlan_group:<br>
+        if not (cfg.CONF.VXLAN.vxlan_group or cfg.CONF.VXLAN.vxlan_group_auto):<br>
             LOG.warning(_LW('VXLAN muticast group must be provided in '<br>
-                            'vxlan_group option to enable VXLAN MCAST mode'))<br>
+                            'vxlan_group option or vxlan_group_auto must '<br>
+                            'be True to enable VXLAN MCAST mode'))<br>
             return False<br>
         if not ip_lib.iproute_arg_supported(<br>
                 ['ip', 'link', 'add', 'type', 'vxlan'],<br>
<br>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote></div><br></div>