Skip to main content

Linux Kernel Networking

Linux kernel networking — network stack source code analysis, from link layer to socket layer. 124 chapters.

9.8 The Dance Between NAT Hook Callbacks and Conntrack Hook Callbacks

In the previous section, we registered the `nfnatipv4_ops` hook array into the kernel, much like setting up checkpoints on a highway that every packet must pass through. But if you look closely at these checkpoints, you'll notice something interesting: at some of them, both conntrack is checking IDs and NAT is modifying addresses. They crowd the same hook point, and the order in which they execute is a detail that can literally make or break the connection.