> ifindex is pretty much everywhere because it (as far as I know) > originated in BSD and has since then been enshrined in SNMP and > elsewhere.
Fine with me then. Ethan > > On Thu, Jun 13, 2013 at 02:48:56PM -0700, Ethan Jackson wrote: >> Since this is OS specific, perhaps we should put it in the status >> column instead? >> >> Ethan >> >> On Thu, Jun 13, 2013 at 2:42 PM, Neil Mckee <neil.mc...@inmon.com> wrote: >> > This proposed patch adds an "ifindex" column to the "Interface" table in >> > the db. So that >> > "ovs-vsctl list Interface" can show the ifindex numbers for those >> > interfaces that have >> > them (and 0 for the rest). >> > >> > For example: >> > >> > % ovs-vsctl --format json --columns name,ofport,ifindex list Interface >> > {"data":[["br2",65534,10],["eth0",1,2],["br1",65534,9],["vm",2,11],["gre0",1,0]],"headings":["name","ofport","ifindex"]} >> > >> > >> > Signed-off-by: Neil McKee <neil.mc...@inmon.com> >> > >> > --- >> > vswitchd/bridge.c | 16 ++++++++++++++++ >> > vswitchd/vswitch.ovsschema | 7 +++++-- >> > 2 files changed, 21 insertions(+), 2 deletions(-) >> > >> > diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c >> > index 09f98d5..0bd3c1d 100644 >> > --- a/vswitchd/bridge.c >> > +++ b/vswitchd/bridge.c >> > @@ -373,6 +373,7 @@ bridge_init(const char *remote) >> > ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_cfm_health); >> > ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_cfm_remote_opstate); >> > ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_lacp_current); >> > + ovsdb_idl_omit_alert(idl, &ovsrec_interface_col_ifindex); >> > ovsdb_idl_omit(idl, &ovsrec_interface_col_external_ids); >> > >> > ovsdb_idl_omit_alert(idl, &ovsrec_controller_col_is_connected); >> > @@ -1709,6 +1710,7 @@ iface_refresh_status(struct iface *iface) >> > int64_t mtu_64; >> > uint8_t mac[ETH_ADDR_LEN]; >> > int error; >> > + int64_t ifindex64; >> > >> > if (iface_is_synthetic(iface)) { >> > return; >> > @@ -1753,6 +1755,19 @@ iface_refresh_status(struct iface *iface) >> > } else { >> > ovsrec_interface_set_mac_in_use(iface->cfg, NULL); >> > } >> > + >> > + ifindex64 = (int64_t)netdev_get_ifindex(iface->netdev); >> > + if(ifindex64 < 0) { >> > + /* The netdev may return a negative number (such as -EOPNOTSUPP) >> > + * if there is no valid ifindex number. Report than as 0 here. >> > + * 0 is not a valid ifindex number, so we can use it to mean >> > + * "Not applicable, or don't know, or something went wrong". It >> > + * may be necessary to revist this if we don't want to collapse >> > + * those states. >> > + */ >> > + ifindex64 = 0; >> > + } >> > + ovsrec_interface_set_ifindex(iface->cfg, ifindex64); >> > } >> > >> > /* Writes 'iface''s CFM statistics to the database. 'iface' must not be >> > @@ -3443,6 +3458,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, 0); >> > } >> > } >> > >> > diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema >> > index 594ffb4..e08502f 100644 >> > --- a/vswitchd/vswitch.ovsschema >> > +++ b/vswitchd/vswitch.ovsschema >> > @@ -1,6 +1,6 @@ >> > {"name": "Open_vSwitch", >> > - "version": "7.1.0", >> > - "cksum": "2234055133 17444", >> > + "version": "7.1.1", >> > + "cksum": "689297048 17521", >> > "tables": { >> > "Open_vSwitch": { >> > "columns": { >> > @@ -164,6 +164,9 @@ >> > "name": { >> > "type": "string", >> > "mutable": false}, >> > + "ifindex": { >> > + "type": "integer", >> > + "ephemeral": true}, >> > "type": { >> > "type": "string"}, >> > "options": { >> > -- >> > 1.8.1.4 >> > >> > _______________________________________________ >> > dev mailing list >> > dev@openvswitch.org >> > http://openvswitch.org/mailman/listinfo/dev >> _______________________________________________ >> dev mailing list >> dev@openvswitch.org >> http://openvswitch.org/mailman/listinfo/dev _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev