lkml.org 
[lkml]   [2011]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH] TODO FLAG_POINTTOPOINT => FLAG_WWAN? usbnet/cdc_ncm: mark ncm devices as "mobile broadband devices" with FLAG_WWAN
From
Date
On Thu, 2011-06-02 at 17:29 -0500, Dan Williams wrote:
> On Wed, 2011-06-01 at 12:20 +0200, Alexey ORISHKO wrote:
> > > -----Original Message-----
> > > From: netdev-owner@vger.kernel.org [mailto:netdev-
> > > owner@vger.kernel.org] On Behalf Of Stefan Metzmacher
> > > Sent: Wednesday, June 01, 2011 12:09 PM
> >
> >
> > > - .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET,
> > > + .flags = FLAG_WWAN | FLAG_NO_SETINT | FLAG_MULTI_PACKET,
> >
> > This patch will introduce incompatibility with already existing
> > applications, which track usbX devices. As a result, end user
> > application will stop working.
>
> Applications should *never* track devices based solely on a device name
> prefix. What do they do when the device gets renamed either by udev
> rules or the user? It's simply broken. Device names are not stable API
> and they can and do change at will. Applications that expect them to
> have a stable prefix are simply broken.

A follow-on to this is that if you really care about specific devices,
your application can use udev rules to "tag" specific interfaces based
on USB VID/PID/GUID or other device attributes, and check for those tags
in your program. Use udev (good) or netlink (good) or SIOCGIFCONF (bad)
to enumerate the various network interfaces on the system and pick the
one you want using the udev tags instead of hardcoding stuff that will
inevitably break, as you've seen here. Yeah, it's more code. But hey,
it doesn't break when people do something you don't expect!

Dan




\
 
 \ /
  Last update: 2011-06-03 00:35    [from the cache]
©2003-2011 Jasper Spaans