---
title: "Socket & cgroup hooks"
---

> Documentation Index
> Fetch the complete documentation index at: https://example.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Socket & cgroup hooks

At the top of the stack, `cgroup/connect4`, `sock_ops`, and `sk_msg` hooks operate on sockets rather than packets. They know the exact process, container cgroup, and destination service.

Service meshes and CNIs rewrite destination IPs *at connect time* (skipping per-packet NAT) and use `SOCKMAP` to copy bytes straight from one local pod's send socket to another's receive socket, skipping TCP/IP.

> **Key idea:** Socket hooks trade raw wire visibility for rich identity and zero-overhead local redirects—ideal for Kubernetes Services and L4 policy.

Source: https://example.com/ebpf-field-guide/networking-and-packet-path/networking-hooks/sockets/index.mdx
