aboutsummaryrefslogtreecommitdiff
path: root/vswitchd
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@nicira.com>2013-03-12 14:47:22 -0700
committerJustin Pettit <jpettit@nicira.com>2013-03-12 16:04:06 -0700
commit524eae67a601e05b1f4dab856d66e9e13aad69f3 (patch)
tree4a9641568bc9c1eabdb40b55bf904d3739a089c0 /vswitchd
parent1f3050b88836cf8bc787d38447778d38a787bc8d (diff)
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>
Diffstat (limited to 'vswitchd')
-rw-r--r--vswitchd/bridge.c13
-rw-r--r--vswitchd/vswitch.ovsschema8
-rw-r--r--vswitchd/vswitch.xml4
3 files changed, 23 insertions, 2 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 8fa126e3..1c4a0d74 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -346,6 +346,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);
@@ -1703,6 +1704,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)) {
@@ -1740,6 +1742,16 @@ iface_refresh_status(struct iface *iface)
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
@@ -3357,6 +3369,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);
diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema
index 16125a5b..3e702d44 100644
--- a/vswitchd/vswitch.ovsschema
+++ b/vswitchd/vswitch.ovsschema
@@ -1,6 +1,6 @@
{"name": "Open_vSwitch",
- "version": "6.11.3",
- "cksum": "2234602985 17310",
+ "version": "6.12.0",
+ "cksum": "2180939265 17455",
"tables": {
"Open_vSwitch": {
"columns": {
@@ -174,6 +174,10 @@
"ingress_policing_burst": {
"type": {"key": {"type": "integer",
"minInteger": 0}}},
+ "mac_in_use": {
+ "type": {"key": {"type": "string"},
+ "min": 0, "max": 1},
+ "ephemeral": true},
"mac": {
"type": {"key": {"type": "string"},
"min": 0, "max": 1}},
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 4f825890..bfdb28fb 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1147,6 +1147,10 @@
on a host.
</column>
+ <column name="mac_in_use">
+ The MAC address in use by this interface.
+ </column>
+
<column name="mac">
<p>Ethernet address to set for this interface. If unset then the
default MAC address is used:</p>