Skip to content

Latest commit

History

History
77 lines (39 loc) 路 3.45 KB

2_NetlinkProtocolNumber.md

File metadata and controls

77 lines (39 loc) 路 3.45 KB

馃摉 Understanding Netlink Protocol Number

Diving into the intricate details of the Netlink protocol number, we aim to grasp its significance in the context of the Linux kernel. Let's begin!


1. Introduction to Netlink Protocol Number 馃

  • Within the Linux kernel, various subsystems coexist, and they all need to communicate with user space applications.

  • A pertinent question arises: How does an application determine which Linux kernel subsystem it wishes to interact with? 馃

  • The answer lies in the Netlink protocol number. This is a unique ID assigned to every Linux kernel subsystem.


2. Purpose of the Netlink Protocol Number 馃幆

  • Each Linux kernel subsystem is distinguished by a unique Netlink protocol number.

  • User space applications utilize this number to specify their desired communication partner among the various Netlink subsystems.


3. Existing and Reserved Protocol Numbers 馃摐

  • Several Netlink protocol numbers have been pre-reserved for existing kernel subsystems.

  • For instance, the entire routing infrastructure and the TCP/IP stack in the Linux kernel are allocated a protocol number: zero.

  • These assignments can be found in the file: Linux/netlink.h.


4. Some Noteworthy Protocol Numbers 馃敘

  • The TCP/IP stack and routing infrastructure are linked with the Netlink protocol number Netlink route, which is zero.

  • The firewall infrastructure in the Linux kernel bears the number three.

  • There's an upper limit: 32. This is the maximum Netlink protocol number available. Extending beyond this requires changing this limit.


5. Our Netlink Project & Protocol Number Selection 馃殌

  • In our endeavor, we will deploy a new Linux kernel module. This module will act as a new kernel subsystem.

  • The communication between applications and this new kernel subsystem will use the unused Netlink protocol number: 31.


馃 Interview Questions on Netlink Protocol Number

Q1: What is the primary function of a Netlink protocol number in the Linux kernel?

Answer: The Netlink protocol number serves as a unique ID for each Linux kernel subsystem, enabling user space applications to determine and communicate with their desired subsystem.

Q2: Where can one find the list of existing Netlink protocol numbers and their respective kernel subsystems?

Answer: The list is available in the file Linux/netlink.h, which contains the Netlink protocol numbers assigned to various kernel subsystems.

Q3: Which Netlink protocol number is assigned to the TCP/IP stack and the routing infrastructure in the Linux kernel?

Answer: The TCP/IP stack and routing infrastructure are allocated the Netlink protocol number Netlink route, which is zero.

Q4: What's the maximum permissible value for a Netlink protocol number, and what happens if we wish to exceed this limit?

Answer: The upper limit for a Netlink protocol number is 32. To utilize a number beyond this limit, one would need to modify this constraint in the kernel configuration.

Q5: In our project, which Netlink protocol number will our new kernel subsystem utilize?

Answer: In our project, the new kernel subsystem will communicate using the Netlink protocol number 31.


I hope this markdown guide aids in the thorough understanding of the Netlink protocol number and preps you well for any related interview questions! 馃専