So guys, before proceeding further into writing our complete Netlink based Linux kernel module, let
us understand the concept of Netlink protocol number so you can see that in this diagram.
We have various Linux kernel subsystems running in the Linux kernel and userspace application can choose
to communicate with any Linux kernel subsystems running in the Linux kernel.
So the question is that that how application would identify that with which Linux kernel subsystems
it wants to communicate with.
The simple answer is that that every Linux kernel subsystem is assigned a unique ID.
This unique ID is called Netlink protocol number and this Netlink protocol number is used by userspace
application to specify that with which netlink subsystems it wants to communicate with.
Right now we already know that various Linux subsystems already exist in the Linux kernel.
Therefore, there are some netlink protocol numbers which have been reserved for these existing kernel
subsystems.
For example, the entire routing infrastructure and TCP IP stack residing in the Linux kernel is assigned
a unique Netlink protocol number as zero.
Right?
So you can see that what netlink protocol numbers are being in use already in the file Linux slash netlink
dot h.
So you can see that I'm in the file Linux slash netlink dot h.
And in this file you can see that these are the netlink protocol numbers which are already being used
and assigned to various Linux kernel subsystems, right?
So you can see that the entire TCP IP stack and the routing infrastructure running in the Linux kernel
subsystem is assigned a Netlink protocol number as zero, and we call this Netlink protocol number as
Netlink route.
Right?
Similarly, the firewall infrastructure setting in the Linux kernel is assigned the value three.
And you can see that the maximum netlink protocol number that we can use is 32.
If we want to use a Netlink protocol number beyond 32, probably we need to increase this limit.
Right?
So in our project we will going to deploy a Linux kernel module as a new Linux kernel subsystem and
therefore we will going to use the unused value which is 31.
So we will going to write our own Linux kernel module which behaves as a new kernel subsystem and the
application will going to interact with our kernel subsystem using the Netlink protocol number 31.