X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=vswitchd%2Fbridge.c;h=9449879f897636ed6f48bda42bffdec11b782719;hb=fba6bd1d3f5891471daea8bf5da22303c2d889df;hp=f7932c74a261444c0d8587b8b6a7a3ccc0ec1eaf;hpb=4cd9ab26c3a265d168d082b9e50777b9306fe2f8;p=sliver-openvswitch.git diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index f7932c74a..9449879f8 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -318,7 +318,7 @@ void bridge_init(const char *remote) { /* Create connection to database. */ - idl = ovsdb_idl_create(remote, &ovsrec_idl_class, true); + idl = ovsdb_idl_create(remote, &ovsrec_idl_class, true, true); idl_seqno = ovsdb_idl_get_seqno(idl); ovsdb_idl_set_lock(idl, "ovs_vswitchd"); ovsdb_idl_verify_write_only(idl); @@ -345,6 +345,7 @@ bridge_init(const char *remote) ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_link_speed); ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_link_state); ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_link_resets); + ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_mac_in_use); ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_mtu); ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_ofport); ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_statistics); @@ -1698,6 +1699,7 @@ iface_refresh_status(struct iface *iface) int64_t bps; int mtu; int64_t mtu_64; + uint8_t mac[ETH_ADDR_LEN]; int error; if (iface_is_synthetic(iface)) { @@ -1721,8 +1723,7 @@ iface_refresh_status(struct iface *iface) netdev_features_is_full_duplex(current) ? "full" : "half"); ovsrec_interface_set_link_speed(iface->cfg, &bps, 1); - } - else { + } else { ovsrec_interface_set_duplex(iface->cfg, NULL); ovsrec_interface_set_link_speed(iface->cfg, NULL, 0); } @@ -1731,10 +1732,19 @@ iface_refresh_status(struct iface *iface) if (!error) { mtu_64 = mtu; ovsrec_interface_set_mtu(iface->cfg, &mtu_64, 1); - } - else { + } else { ovsrec_interface_set_mtu(iface->cfg, NULL, 0); } + + error = netdev_get_etheraddr(iface->netdev, mac); + if (!error) { + char mac_string[32]; + + sprintf(mac_string, ETH_ADDR_FMT, ETH_ADDR_ARGS(mac)); + ovsrec_interface_set_mac_in_use(iface->cfg, mac_string); + } else { + ovsrec_interface_set_mac_in_use(iface->cfg, NULL); + } } /* Writes 'iface''s CFM statistics to the database. 'iface' must not be @@ -3332,6 +3342,7 @@ iface_clear_db_record(const struct ovsrec_interface *if_cfg) ovsrec_interface_set_duplex(if_cfg, NULL); ovsrec_interface_set_link_speed(if_cfg, NULL, 0); ovsrec_interface_set_link_state(if_cfg, NULL); + ovsrec_interface_set_mac_in_use(if_cfg, NULL); ovsrec_interface_set_mtu(if_cfg, NULL, 0); ovsrec_interface_set_cfm_fault(if_cfg, NULL, 0); ovsrec_interface_set_cfm_fault_status(if_cfg, NULL, 0);