mirror of
https://github.com/openvswitch/ovs
synced 2025-08-29 21:38:13 +00:00
bridge: Store the 'mac_in_use' for interfaces in OVSDB.
It can be useful to remotely determine the MAC addresses of attached interfaces without going through OpenFlow. This adds the MAC address to a new 'mac_in_use' column on the Interface table. Feature #15551 Requested-by: Paul Ingram <paul@nicira.com> Signed-off-by: Justin Pettit <jpettit@nicira.com>
This commit is contained in:
parent
8d6db33e35
commit
df867eda40
@ -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_speed);
|
||||||
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_link_state);
|
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_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_mtu);
|
||||||
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_ofport);
|
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_ofport);
|
||||||
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_statistics);
|
ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_statistics);
|
||||||
@ -1698,6 +1699,7 @@ iface_refresh_status(struct iface *iface)
|
|||||||
int64_t bps;
|
int64_t bps;
|
||||||
int mtu;
|
int mtu;
|
||||||
int64_t mtu_64;
|
int64_t mtu_64;
|
||||||
|
uint8_t mac[ETH_ADDR_LEN];
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (iface_is_synthetic(iface)) {
|
if (iface_is_synthetic(iface)) {
|
||||||
@ -1733,6 +1735,16 @@ iface_refresh_status(struct iface *iface)
|
|||||||
} else {
|
} else {
|
||||||
ovsrec_interface_set_mtu(iface->cfg, NULL, 0);
|
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
|
/* Writes 'iface''s CFM statistics to the database. 'iface' must not be
|
||||||
@ -3330,6 +3342,7 @@ iface_clear_db_record(const struct ovsrec_interface *if_cfg)
|
|||||||
ovsrec_interface_set_duplex(if_cfg, NULL);
|
ovsrec_interface_set_duplex(if_cfg, NULL);
|
||||||
ovsrec_interface_set_link_speed(if_cfg, NULL, 0);
|
ovsrec_interface_set_link_speed(if_cfg, NULL, 0);
|
||||||
ovsrec_interface_set_link_state(if_cfg, NULL);
|
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_mtu(if_cfg, NULL, 0);
|
||||||
ovsrec_interface_set_cfm_fault(if_cfg, NULL, 0);
|
ovsrec_interface_set_cfm_fault(if_cfg, NULL, 0);
|
||||||
ovsrec_interface_set_cfm_fault_status(if_cfg, NULL, 0);
|
ovsrec_interface_set_cfm_fault_status(if_cfg, NULL, 0);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{"name": "Open_vSwitch",
|
{"name": "Open_vSwitch",
|
||||||
"version": "7.0.0",
|
"version": "7.1.0",
|
||||||
"cksum": "3537583872 17299",
|
"cksum": "2234055133 17444",
|
||||||
"tables": {
|
"tables": {
|
||||||
"Open_vSwitch": {
|
"Open_vSwitch": {
|
||||||
"columns": {
|
"columns": {
|
||||||
@ -174,6 +174,10 @@
|
|||||||
"ingress_policing_burst": {
|
"ingress_policing_burst": {
|
||||||
"type": {"key": {"type": "integer",
|
"type": {"key": {"type": "integer",
|
||||||
"minInteger": 0}}},
|
"minInteger": 0}}},
|
||||||
|
"mac_in_use": {
|
||||||
|
"type": {"key": {"type": "string"},
|
||||||
|
"min": 0, "max": 1},
|
||||||
|
"ephemeral": true},
|
||||||
"mac": {
|
"mac": {
|
||||||
"type": {"key": {"type": "string"},
|
"type": {"key": {"type": "string"},
|
||||||
"min": 0, "max": 1}},
|
"min": 0, "max": 1}},
|
||||||
|
@ -1131,6 +1131,10 @@
|
|||||||
on a host.
|
on a host.
|
||||||
</column>
|
</column>
|
||||||
|
|
||||||
|
<column name="mac_in_use">
|
||||||
|
The MAC address in use by this interface.
|
||||||
|
</column>
|
||||||
|
|
||||||
<column name="mac">
|
<column name="mac">
|
||||||
<p>Ethernet address to set for this interface. If unset then the
|
<p>Ethernet address to set for this interface. If unset then the
|
||||||
default MAC address is used:</p>
|
default MAC address is used:</p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user