[ovs-dev] [PATCH v2] vswitch: Allow user to set Ethernet address of any internal interface.

Ian Campbell Ian.Campbell at eu.citrix.com
Mon Oct 5 13:59:55 UTC 2009

On Sat, 2009-10-03 at 01:16 +0100, Ben Pfaff wrote:
> Until now the vswitch configuration file has allowed the user to configure
> the MAC address on bridge local ports only.  This commit adds the ability
> to configure them on any internal interface.
> It would be logical to extend this to any bridge port, period, but many
> network devices must be brought down before their Ethernet addresses may be
> changed.  Bringing a network interface down and then back up can reset a
> lot of state, so as we don't actually need the ability to change any bridge
> port's MAC address yet this commit does not implement it.

I forward-ported this and 1/2 from the previous posting (introduce
iface_is_internal). Apart from some relatively minor context change
issues the only thing I had to change was:

diff -r 5309f8afbce9 vswitchd/bridge.c
--- a/vswitchd/bridge.c Mon Oct 05 14:18:58 2009 +0100
+++ b/vswitchd/bridge.c Mon Oct 05 14:47:07 2009 +0100
@@ -3237,7 +3237,7 @@
             VLOG_ERR("ignoring iface.%s.mac; use bridge.%s.mac instead",
                      iface->name, iface->name);
         } else {
-            int error = netdev_nodev_set_etheraddr(iface->name, ea);
+            int error = netdev_set_etheraddr(iface->netdev, ea);
             if (error) {
                 VLOG_ERR("interface %s: setting MAC failed (%s)",
                          iface->name, strerror(error));

I'm not sure that is correct, but together with this
interface-reconfigure patch it seems to work...

diff -r 63b85b9ae50c scripts/interface-reconfigure
--- a/scripts/interface-reconfigure	Fri Oct 02 14:23:40 2009 +0100
+++ b/scripts/interface-reconfigure	Mon Oct 05 14:35:06 2009 +0100
@@ -1458,6 +1458,7 @@
         cfgmod_argv += datapath_deconfigure_ipdev(ipdev)
         cfgmod_argv += ["# reconfigure ipdev %s" % ipdev]
         cfgmod_argv += ['--add=bridge.%s.port=%s' % (bridge, ipdev)]
+        cfgmod_argv += ['--add=iface.%s.mac=%s' % (ipdev, db.get_pif_record(dp)['MAC'])]
     f = ipdev_configure_network(pif)

I still see messages like:
        Oct 05 14:48:39|00133|bridge|WARN|bridge xapi2: using default bridge Ethernet address 16:ff:22:d8:a2:e0
in /var/log/ovs-vswitch.log but the address doesn't seem to end up
anywhere visible.


More information about the dev mailing list