aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r--net/ipv4/inet_diag.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 1a4e9ff02762..5731670c560b 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -108,6 +108,7 @@ static size_t inet_sk_attr_size(struct sock *sk,
108 + nla_total_size(1) /* INET_DIAG_TOS */ 108 + nla_total_size(1) /* INET_DIAG_TOS */
109 + nla_total_size(1) /* INET_DIAG_TCLASS */ 109 + nla_total_size(1) /* INET_DIAG_TCLASS */
110 + nla_total_size(4) /* INET_DIAG_MARK */ 110 + nla_total_size(4) /* INET_DIAG_MARK */
111 + nla_total_size(4) /* INET_DIAG_CLASS_ID */
111 + nla_total_size(sizeof(struct inet_diag_meminfo)) 112 + nla_total_size(sizeof(struct inet_diag_meminfo))
112 + nla_total_size(sizeof(struct inet_diag_msg)) 113 + nla_total_size(sizeof(struct inet_diag_msg))
113 + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) 114 + nla_total_size(SK_MEMINFO_VARS * sizeof(u32))
@@ -287,12 +288,19 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
287 goto errout; 288 goto errout;
288 } 289 }
289 290
290 if (ext & (1 << (INET_DIAG_CLASS_ID - 1))) { 291 if (ext & (1 << (INET_DIAG_CLASS_ID - 1)) ||
292 ext & (1 << (INET_DIAG_TCLASS - 1))) {
291 u32 classid = 0; 293 u32 classid = 0;
292 294
293#ifdef CONFIG_SOCK_CGROUP_DATA 295#ifdef CONFIG_SOCK_CGROUP_DATA
294 classid = sock_cgroup_classid(&sk->sk_cgrp_data); 296 classid = sock_cgroup_classid(&sk->sk_cgrp_data);
295#endif 297#endif
298 /* Fallback to socket priority if class id isn't set.
299 * Classful qdiscs use it as direct reference to class.
300 * For cgroup2 classid is always zero.
301 */
302 if (!classid)
303 classid = sk->sk_priority;
296 304
297 if (nla_put_u32(skb, INET_DIAG_CLASS_ID, classid)) 305 if (nla_put_u32(skb, INET_DIAG_CLASS_ID, classid))
298 goto errout; 306 goto errout;