]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests/bpf: Ensure cgroup/connect{4,6} programs can bind unpriv ICMP ping
authorYiFei Zhu <zhuyifei@google.com>
Fri, 9 Sep 2022 00:49:41 +0000 (00:49 +0000)
committerMartin KaFai Lau <martin.lau@kernel.org>
Fri, 9 Sep 2022 17:40:45 +0000 (10:40 -0700)
commit58c449a96946929467b537589c8a23f11e04af39
treeffea21e0a4d42c7ddd9ddf8dc56c14a2dd52f306
parente42921c3c346b1b49068af3f3881322081e1dddd
selftests/bpf: Ensure cgroup/connect{4,6} programs can bind unpriv ICMP ping

This tests that when an unprivileged ICMP ping socket connects,
the hooks are actually invoked. We also ensure that if the hook does
not call bpf_bind(), the bound address is unmodified, and if the
hook calls bpf_bind(), the bound address is exactly what we provided
to the helper.

A new netns is used to enable ping_group_range in the test without
affecting ouside of the test, because by default, not even root is
permitted to use unprivileged ICMP ping...

Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Link: https://lore.kernel.org/r/086b227c1b97f4e94193e58aae7576d0261b68a4.1662682323.git.zhuyifei@google.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/prog_tests/connect_ping.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/connect_ping.c [new file with mode: 0644]