Message ID | CAMDZJNXG-c0YuGk-i8mW=WRxMn=04LfH9D0DMS-9XoQo+LAAgQ@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [ovs-dev] interface mac setting | expand |
On Tue, Apr 24, 2018 at 10:55:36AM +0800, Tonghao Zhang wrote: > One question, why now ovs can only set the mac of internal interface, > for example: > > ovs-vsctl set Interface p1 type=internal mac=\"00:11:22:33:44:55\" > ovs-vsctl get Interface p1 mac_in_use > > And the doc about 'mac' is not explained, why we cannot set it for > other type interface. So it's a bug? It's more like a bug in the documentation. Please feel free to submit an update. The reasoning here is that the OVS database isn't a good place to set things for which OVS is not the source of truth. Suppose someone comes along and runs "ifconfig" or "ip" to change the MAC address. In that case, the OVS database is then out-of-date. Should OVS then immediately set the MAC address back to what's in the database? It's not good for OVS to start fights like that.
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index d90997e..28dd7f8 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -4416,10 +4416,6 @@ iface_set_mac(const struct bridge *br, const struct port *port, struct iface *if struct eth_addr ea, *mac = NULL; struct iface *hw_addr_iface; - if (strcmp(iface->type, "internal")) { - return; - } - if (iface->cfg->mac && eth_addr_from_string(iface->cfg->mac, &ea)) { mac = &ea;