Sometimes when working with network packets inside the Linux kernel, it might be very useful to print packet contents to see what is actually going on. Here I’m describing how to print packet from sk_buff structure and analyze this data with Wireshark. In this short note, I will not describe capturing the packets inside the kernel but only show how…
Tag: network
Modifying Linux network routes using netlink
Last time we talked about getting a Linux routing table with a simple Netlink code. Now it’s time to do more interesting stuff. Let’s add and delete some routes using the power of the Netlink!
Monitoring Linux networking state using netlink
Once in my work, I needed to monitor all changes in the Linux networking subsystem: adding or deleting IP addresses, routes, etc. Maybe the best way to do this is to use socket-based Netlink technology. Using Netlink, we can “subscribe” to some network-related notifications from the kernel. It’s also possible to send commands to the network stack and change the…