On Tue, 2013-01-29 at 18:29 +0000, Matthew Garrett wrote:
On Tue, Jan 29, 2013 at 12:13:37PM -0600, Andrew McNabb wrote:
> On Tue, Jan 29, 2013 at 06:11:19PM +0000, Matthew Garrett wrote:
> >
> > Walk /sys/class/net, filter on type, filter out bridges, filter out
> > wireless if you want to. sysfs should have all the information you need
> > without name-based heuristics.
>
> You have added confirmation that any attempt to figure out the name of
> the interface is an ugly brittle mess. ;)
What is "The ethernet device"? It's the device that speaks ethernet and
which isn't wireless or a bridge. The correct way to identify it is to
look for devices that speak ethernet and which aren't wireless or
bridges.
Except then you run into phones or WWAN cards that show up as Ethernet
devices, but aren't really Ethernet but just IP-in-8023-frames because
that was easier to do on Windows. That one is quite fun, and there's no
good way to catch them all. We're obviously behind by marking them
FLAG_WWAN in the kernel, which has to be done by device IDs, becasue
some devices use standard cdc-ether or cdc-eem and you can't reliably
tell them apart from some random D-Link DUB100.
Dan