On Mon, Dec 09, 2013 at 09:01:57AM +0100, Helmut Schaa wrote:
> On Sat, Dec 7, 2013 at 6:20 PM, Ben Pfaff <b...@nicira.com> wrote:
> > On Fri, Dec 06, 2013 at 04:18:42PM +0100, Helmut Schaa wrote:
> >> When adding a physical port to the main bridge the mac address
> >> of the bridge is updated. We can do the same for fake bridges by
> >> copying the mac address of the parent bridge.
> >>
> >> There exists only one fake bridge per vlan, hence it is safe
> >> to copy the mac address of the parent bridge.
> >>
> >> Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
> >
> > Why do we want to do this?
> 
> Same reason as why a regular ovs bridge tries to use the mac address of a
> physical port instead of using a random mac. If the fake bridge is used as 
> local
> access port to the specified VLAN it definitely makes sense to use a "physical
> MAC" if any is suitable for use to not confuse other network participants 
> with a
> random MAC (DHCP server for example). Another option would have been to
> copy the main bridge logic and only consider ports on the same VLAN as the
> fake bridge for MAC inheritance.
> 
> Hope this clarifies my intent,
> Helmut

OK.

After thinking about this for a while, I decided to apply this.

I folded in the following stylistic changes.

Thank you for the contribution!

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 03280a2..e6be975 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -577,7 +577,7 @@ bridge_reconfigure(const struct ovsrec_open_vswitch 
*ovs_cfg)
             LIST_FOR_EACH (iface, port_elem, &port->ifaces) {
                 iface_configure_cfm(iface);
                 iface_configure_qos(iface, port->cfg->qos);
-                iface_set_mac(iface, (port->cfg->fake_bridge ? br->ea : NULL));
+                iface_set_mac(iface, port->cfg->fake_bridge ? br->ea : NULL);
                 ofproto_port_set_bfd(br->ofproto, iface->ofp_port,
                                      &iface->cfg->bfd);
             }
@@ -3494,11 +3494,13 @@ iface_set_mac(struct iface *iface, const uint8_t *mac)
 {
     uint8_t ea[ETH_ADDR_LEN];
 
-    if (strcmp(iface->type, "internal"))
+    if (strcmp(iface->type, "internal")) {
         return;
+    }
 
-    if (iface->cfg->mac && eth_addr_from_string(iface->cfg->mac, ea))
+    if (iface->cfg->mac && eth_addr_from_string(iface->cfg->mac, ea)) {
         mac = ea;
+    }
 
     if (mac) {
         if (iface->ofp_port == OFPP_LOCAL) {

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to