2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 09:58:01 +00:00

bridge: Add ifindex column to Interface table.

This commit adds an "ifindex" column to the "Interface" table in the db.

Signed-off-by: Neil McKee <neil.mckee@inmon.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Neil McKee 2013-07-08 13:36:06 -07:00 committed by Ben Pfaff
parent 91aaf1248e
commit ea401d9ace
4 changed files with 29 additions and 2 deletions

2
NEWS
View File

@ -4,6 +4,8 @@ post-v1.11.0
* New support for matching outer source and destination IP address
of tunneled packets, for tunnel ports configured with the newly
added "remote_ip=flow" and "local_ip=flow" options.
- The Interface table in the database has a new "ifindex" column to
report the interface's OS-assigned ifindex.
- New "check-oftest" Makefile target for running OFTest against Open
vSwitch. See README-OFTest for details.
- The flow eviction threshold has been moved to the Open_vSwitch table.

View File

@ -367,6 +367,7 @@ bridge_init(const char *remote)
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_ifindex);
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);
@ -1810,6 +1811,7 @@ iface_refresh_status(struct iface *iface)
int mtu;
int64_t mtu_64;
uint8_t mac[ETH_ADDR_LEN];
int64_t ifindex64;
int error;
if (iface_is_synthetic(iface)) {
@ -1855,6 +1857,14 @@ iface_refresh_status(struct iface *iface)
} else {
ovsrec_interface_set_mac_in_use(iface->cfg, NULL);
}
/* The netdev may return a negative number (such as -EOPNOTSUPP)
* if there is no valid ifindex number. */
ifindex64 = netdev_get_ifindex(iface->netdev);
if (ifindex64 < 0) {
ifindex64 = 0;
}
ovsrec_interface_set_ifindex(iface->cfg, &ifindex64, 1);
}
/* Writes 'iface''s CFM statistics to the database. 'iface' must not be
@ -3573,6 +3583,7 @@ iface_clear_db_record(const struct ovsrec_interface *if_cfg)
ovsrec_interface_set_cfm_remote_mpids(if_cfg, NULL, 0);
ovsrec_interface_set_lacp_current(if_cfg, NULL, 0);
ovsrec_interface_set_statistics(if_cfg, NULL, NULL, 0);
ovsrec_interface_set_ifindex(if_cfg, NULL, 0);
}
}

View File

@ -1,6 +1,6 @@
{"name": "Open_vSwitch",
"version": "7.2.0",
"cksum": "543912409 19436",
"version": "7.2.1",
"cksum": "707387125 19667",
"tables": {
"Open_vSwitch": {
"columns": {
@ -185,6 +185,14 @@
"mac": {
"type": {"key": {"type": "string"},
"min": 0, "max": 1}},
"ifindex": {
"type": {
"key": {"type": "integer",
"minInteger": 0,
"maxInteger": 4294967295},
"min": 0,
"max": 1},
"ephemeral": true},
"external_ids": {
"type": {"key": "string", "value": "string", "min": 0, "max": "unlimited"}},
"ofport": {

View File

@ -1208,6 +1208,12 @@
on a host.
</column>
<column name="ifindex">
A positive interface index as defined for SNMP MIB-II in RFCs 1213 and
2863, if the interface has one, otherwise 0. The ifindex is useful for
seamless integration with protocols such as SNMP and sFlow.
</column>
<column name="mac_in_use">
The MAC address in use by this interface.
</column>