From: Martin KaFai Lau Date: Fri, 9 Sep 2022 17:40:45 +0000 (-0700) Subject: Merge branch 'cgroup/connect{4,6} programs for unprivileged ICMP ping' X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2fae67716bb99a956a4c4a47c0e2ece52a2a15ca;p=linux.git Merge branch 'cgroup/connect{4,6} programs for unprivileged ICMP ping' YiFei Zhu says: ==================== Usually when a TCP/UDP connection is initiated, we can bind the socket to a specific IP attached to an interface in a cgroup/connect hook. But for pings, this is impossible, as the hook is not being called. This series adds the invocation for cgroup/connect{4,6} programs to unprivileged ICMP ping (i.e. ping sockets created with SOCK_DGRAM IPPROTO_ICMP(V6) as opposed to SOCK_RAW). This also adds a test to verify that the hooks are being called and invoking bpf_bind() from within the hook actually binds the socket. Patch 1 adds the invocation of the hook. Patch 2 deduplicates write_sysctl in BPF test_progs. Patch 3 adds the tests for this hook. v1 -> v2: * Added static to bindaddr_v6 in prog_tests/connect_ping.c * Deduplicated much of the test logic in prog_tests/connect_ping.c * Deduplicated write_sysctl() to test_progs.c v2 -> v3: * Renamed variable "obj" to "skel" for the BPF skeleton object in prog_tests/connect_ping.c v3 -> v4: * Fixed error path to destroy skel in prog_tests/connect_ping.c ==================== Signed-off-by: Martin KaFai Lau --- 2fae67716bb99a956a4c4a47c0e2ece52a2a15ca