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 ip
and ifconfig
to establish a network address and route. Thereafter, you interact with the network driver indirectly by opening sockets, and let the network layer decide how to route them to the right interface.
However, it is possible to access network...