netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] inet_diag: fix inet_diag_msg_attrs_fill() for net_cls cgroup
@ 2023-05-08  3:32 Patryk Sondej
  2023-05-08  6:17 ` Leon Romanovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Patryk Sondej @ 2023-05-08  3:32 UTC (permalink / raw)
  To: netdev; +Cc: Patryk Sondej

This commit fixes inet_diag_msg_attrs_fill() function in the ipv4/inet_diag.c file.
The problem was that the function was using CONFIG_SOCK_CGROUP_DATA to check for the net_cls cgroup.
However, the net_cls cgroup is defined by CONFIG_CGROUP_NET_CLASSID instead.

Therefore, this commit updates the #ifdef statement to CONFIG_CGROUP_NET_CLASSID,
and uses the sock_cgroup_classid() function to retrieve the classid from the socket cgroup.

This change ensures that the function correctly retrieves the classid for the net_cls cgroup
and fixes any issues related to the use of the function in this context.

Signed-off-by: Patryk Sondej <patryk.sondej@gmail.com>
---
 net/ipv4/inet_diag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index b812eb36f0e3..7017f88911a6 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -157,7 +157,7 @@ int inet_diag_msg_attrs_fill(struct sock *sk, struct sk_buff *skb,
 	    ext & (1 << (INET_DIAG_TCLASS - 1))) {
 		u32 classid = 0;
 
-#ifdef CONFIG_SOCK_CGROUP_DATA
+#ifdef CONFIG_CGROUP_NET_CLASSID
 		classid = sock_cgroup_classid(&sk->sk_cgrp_data);
 #endif
 		/* Fallback to socket priority if class id isn't set.
-- 
2.37.1 (Apple Git-137.1)


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

end of thread, other threads:[~2023-05-09  7:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-08  3:32 [PATCH net] inet_diag: fix inet_diag_msg_attrs_fill() for net_cls cgroup Patryk Sondej
2023-05-08  6:17 ` Leon Romanovsky
2023-05-08 16:21   ` Kuniyuki Iwashima
2023-05-09  7:48     ` Leon Romanovsky
2023-05-09  7:51       ` Leon Romanovsky

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).