Skip to content

libbpf tc program #101

Answered by chenhengqi
cheneytianx asked this question in Q&A
Aug 18, 2022 · 2 comments · 3 replies
Discussion options

You must be logged in to vote
DECLARE_LIBBPF_OPTS(bpf_tc_hook, tc_hook,
	.ifindex = 4, .attach_point = BPF_TC_EGRESS);
DECLARE_LIBBPF_OPTS(bpf_tc_opts, tc_opts,
	.flags = BPF_TC_F_REPLACE, .handle = 1, .priority = 1);

err = bpf_tc_hook_create(&tc_hook);
if (err)
	return err;

tc_opts.prog_fd = bpf_program__fd(skel->progs.tc_egress);
err = bpf_tc_attach(&tc_hook, &tc_opts);
if (err)
	return err;

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@cheneytianx
Comment options

@vincentmli
Comment options

@chenhengqi
Comment options

Answer selected by cheneytianx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants