netdev: New function netdev_get_ifindex().
[sliver-openvswitch.git] / lib / netdev-provider.h
index a573e24..e013e20 100644 (file)
@@ -113,7 +113,7 @@ struct netdev_class {
      *
      * If this netdev class does not support enumeration, this may be a null
      * pointer. */
-    int (*enumerate)(struct svec *all_anmes);
+    int (*enumerate)(struct svec *all_names);
 
     /* Attempts to receive a packet from 'netdev' into the 'size' bytes in
      * 'buffer'.  If successful, returns the number of bytes in the received
@@ -164,6 +164,16 @@ struct netdev_class {
      * bytes for Ethernet devices.*/
     int (*get_mtu)(const struct netdev *, int *mtup);
 
+    /* Returns the ifindex of 'netdev', if successful, as a positive number.
+     * On failure, returns a negative errno value.
+     *
+     * The desired semantics of the ifindex value are a combination of those
+     * specified by POSIX for if_nametoindex() and by SNMP for ifIndex.  An
+     * ifindex value should be unique within a host and remain stable at least
+     * until reboot.  SNMP says an ifindex "ranges between 1 and the value of
+     * ifNumber" but many systems do not follow this rule anyhow. */
+    int (*get_ifindex)(const struct netdev *);
+
     /* Sets 'carrier' to true if carrier is active (link light is on) on
      * 'netdev'. */
     int (*get_carrier)(const struct netdev *netdev, bool *carrier);