mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
bpftool: Set program type only if it differs from the desired one
After commitd6e6286a12
("libbpf: disassociate section handler on explicit bpf_program__set_type() call"), bpf_program__set_type() will force cleanup the program's SEC() definition, this commit fixed the test helper but missed the bpftool, which leads to bpftool prog autoattach broken as follows: $ bpftool prog load spi-xfer-r1v1.o /sys/fs/bpf/test autoattach Program spi_xfer_r1v1 does not support autoattach, falling back to pinning This patch fix bpftool to set program type only if it differs. Fixes:d6e6286a12
("libbpf: disassociate section handler on explicit bpf_program__set_type() call") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20230407081427.2621590-1-weiyongjun@huaweicloud.com
This commit is contained in:
parent
3ebf5212bf
commit
b24f0b049e
1 changed files with 2 additions and 1 deletions
|
@ -1685,6 +1685,7 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
|
||||||
}
|
}
|
||||||
|
|
||||||
bpf_program__set_ifindex(pos, ifindex);
|
bpf_program__set_ifindex(pos, ifindex);
|
||||||
|
if (bpf_program__type(pos) != prog_type)
|
||||||
bpf_program__set_type(pos, prog_type);
|
bpf_program__set_type(pos, prog_type);
|
||||||
bpf_program__set_expected_attach_type(pos, expected_attach_type);
|
bpf_program__set_expected_attach_type(pos, expected_attach_type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue