Linux Kernel Network Programming - struct sk_buff data-structure - Introduction
Linux Kernel Network Programming - struct sk_buff data-structure - Introduction

struct sk_buff is the Linux Kernel Networking sub-system data-structure in which the contents of individual network packets and its corresponding metadata (port details, socket details, protocol, etc) is stored. It is one of the complex data-structures and highly versatile. Its versatile since it acts as a container data-structure to hold network packet contents, as well the same data-structure can be arranged as linked-list. And each instance of sk_buff can be individual nodes of this linked-list. And this linked-list can be treated as a Network packet Queue. So at times a single instance of sk_buff is independent packet, and some other time, it is just a node holding a packet within a queue of that context (queue’s position) depending upon the context (position of this sk_buff inside kernel code).

One should bear in mind that as much as possible try to avoid sk_buff instances manually, instead always prefer to use its binding already provided APIs for every possible need. sk_buff data-structure is always evolving data-structure, i.e in every major/minor version you should see it getting constantly changed and updated. As more and more features are added to the Kernel Network stack (or sub-system), constantly sk_buff data-structure is updated to accommodate these new ever evolving changes.

As I am a systems and network protocol architect, sk_buff data-structure is close to my heart as it never ceases to amaze me. I shot most video episodes dedicatedly on sk_buff data-structure which you can browse through my website topic category and go through the same. If you have any queries you can contact me, and if you prefer you can also opt for life-time mentorship classes which I conduct for students across the world.

Here is my old episode (original shoot) of the same: