O'Reilly logo

Linux: Embedded Development by Chris Simmonds, Alex González, Alexandru Vaduva

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Network devices

Network devices are not accessed through device nodes and they do not have major and minor numbers. Instead, a network device is allocated a name by the kernel, based on a string and an instance number. Here is an example of the way a network driver registers an interface:

my_netdev = alloc_netdev(0, "net%d", NET_NAME_UNKNOWN, netdev_setup);
ret = register_netdev(my_netdev);

This creates a network device named net0 the first time it is called, net1 the second, and so on. More common names are lo, eth0, and wlan0.

Note that this is the name it starts off with; device managers, such as udev, may change to something different later on.

Usually, the network interface name is only used when configuring the network using utilities such as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required