bpf: Setup socket family and addresses in bpf_prog_test_run_skb
authorDmitry Yakunin <zeil@yandex-team.ru>
Mon, 3 Aug 2020 09:05:44 +0000 (12:05 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 3 Aug 2020 21:31:59 +0000 (23:31 +0200)
commitfa5cb548ced61b9d3095f32f8a7e427a248c65ee
tree04e21e7068cb009498667e619e213bb90ebea164
parentcfa3eb65a7d6da5664d4c9275fbb568a2446d6d9
bpf: Setup socket family and addresses in bpf_prog_test_run_skb

Now it's impossible to test all branches of cgroup_skb bpf program which
accesses skb->family and skb->{local,remote}_ip{4,6} fields because they
are zeroed during socket allocation. This commit fills socket family and
addresses from related fields in constructed skb.

Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200803090545.82046-2-zeil@yandex-team.ru
net/bpf/test_run.c