[ovs-dev] exporting sFlow stats - interface ifIndex numbers

Neil McKee neil.mckee at inmon.com
Fri Nov 6 12:14:29 PST 2009


This is a question about exporting sFlow (and NetFlow) stats,  and  
how to come up with the ifIndex number for each interface.  If the OS  
has already set an ifIndex number for a particular interface,  it  
seems clear that we should use that.   Particularly so that any other  
tools running on the same host, such as snmpd, will agree.   Where  
there is no ifIndex available we have to make one up and ensure that  
it is unique across all defined bridges.

The abstract lib/netdev.h API does not offer the get_ifindex() call,   
but the concrete lib/netdev-linux.c does.    Suppose the abstract  
netdev.h API offered get_ifindex(),  and perhaps returned -1 for  
"dunno"?   That way you can get the OS-assigned ifIndex numbers from  
ofproto/ofproto.c or vswitchd/bridge.c without reaching around and  
breaking the abstraction.

Making up a unique (and preferably persistant) ifIndex number is a  
separate question.   Ideally that could be handled in the get_ifindex 
() call,  but it may not have enough context to do that  
effectively.   For now the sFlow agent is just using the OFPP port  
numbering (1,2,3,....,0xFFFE=internal) and adding high-bits to  
distinguish one bridge from another.  It looks like the NetFlow agent  
does something similar.   If we do it that way should we also watch  
out for any clash with an OS-assigned ifIndex number?  Are we ever  
going to see a mixture of interfaces that have OS-assigned numbers  
and interfaces that don't?

(The same question applies to querying the interface ifType, ifSpeed  
and half/full-duplex details.)

Thoughts?

Neil







More information about the dev mailing list