LWN.net Logo

Char devices for network interfaces

Char devices for network interfaces

Posted Oct 15, 2009 2:54 UTC (Thu) by BenHutchings (subscriber, #37955)
Parent article: Char devices for network interfaces

Actually, the char devices don't even emit uevents. The idea is that the minor number of the device node identifies the net device by its ifindex (an immutable identifier, unlike its name). The char driver only exists to reserve a major number because I (and possibly others) objected to creating device nodes without reserving their numbers.

I have some unfinished code to make the char devices usable as an alternate means of submitting ioctls to net devices. The current method is to call ioctl() on a socket, embedding the device name in the request structure, which can race with device renaming. However, this is probably unnecessary as most or all device control operations can be done through netlink-based APIs which already use ifindex.


(Log in to post comments)

Char devices for network interfaces

Posted Oct 16, 2009 18:59 UTC (Fri) by giraffedata (subscriber, #1954) [Link]

So this is just about keeping a directory of ifindexes? Character device special files seem like a pretty crazy implementation for that. How about a regular file that contains the ifindex? Or a single file that contains the whole directory?

And given that the comments indicate that udev is already capable of setting the name of the network interface, why doesn't the network interface name provide the desired mapping?

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds