linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf v1 1/2] bpf: fix link info netfilter flags to populate defrag flag
@ 2024-10-11 19:32 Tyrone Wu
  2024-10-11 19:32 ` [PATCH bpf v1 2/2] selftests/bpf: add asserts for netfilter link info Tyrone Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tyrone Wu @ 2024-10-11 19:32 UTC (permalink / raw)
  To: bpf, wudevelops
  Cc: pablo, kadlec, davem, edumazet, kuba, pabeni, andrii, eddyz87,
	mykolal, ast, daniel, martin.lau, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, shuah, riel,
	shakeel.butt, netfilter-devel, coreteam, netdev, linux-kernel,
	linux-kselftest, kernel-patches-bot

This patch correctly populates the `bpf_link_info.netfilter.flags` field
when user passes the `BPF_F_NETFILTER_IP_DEFRAG` flag.

Fixes: 84601d6ee68a ("bpf: add bpf_link support for BPF_NETFILTER programs")
Signed-off-by: Tyrone Wu <wudevelops@gmail.com>
---
 net/netfilter/nf_bpf_link.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_bpf_link.c b/net/netfilter/nf_bpf_link.c
index 5257d5e7eb09..797fe8a9971e 100644
--- a/net/netfilter/nf_bpf_link.c
+++ b/net/netfilter/nf_bpf_link.c
@@ -150,11 +150,12 @@ static int bpf_nf_link_fill_link_info(const struct bpf_link *link,
 				      struct bpf_link_info *info)
 {
 	struct bpf_nf_link *nf_link = container_of(link, struct bpf_nf_link, link);
+	const struct nf_defrag_hook *hook = nf_link->defrag_hook;
 
 	info->netfilter.pf = nf_link->hook_ops.pf;
 	info->netfilter.hooknum = nf_link->hook_ops.hooknum;
 	info->netfilter.priority = nf_link->hook_ops.priority;
-	info->netfilter.flags = 0;
+	info->netfilter.flags = hook ? BPF_F_NETFILTER_IP_DEFRAG : 0;
 
 	return 0;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-16 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11 19:32 [PATCH bpf v1 1/2] bpf: fix link info netfilter flags to populate defrag flag Tyrone Wu
2024-10-11 19:32 ` [PATCH bpf v1 2/2] selftests/bpf: add asserts for netfilter link info Tyrone Wu
2024-10-15 15:25 ` [PATCH bpf v1 1/2] bpf: fix link info netfilter flags to populate defrag flag Florian Westphal
2024-10-16 15:13   ` Daniel Borkmann
2024-10-16 15:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).