Commit 62ad6fcd743792bf294f2a7ba26ab8f462065150
Committed by
David S. Miller
1 parent
2021492657
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
udp_diag: implement idiag_get_info for udp/udplite to get queue information
When we use netlink to monitor queue information for udp socket, idiag_rqueue and idiag_wqueue of inet_diag_msg are returned with 0. Keep consistent with netstat, just return back allocated rmem/wmem size. Signed-off-by: Shan Wei <davidshan@tencent.com> Acked-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 2 changed files with 10 additions and 1 deletions Side-by-side Diff
net/ipv4/inet_diag.c
net/ipv4/udp_diag.c
... | ... | @@ -146,9 +146,17 @@ |
146 | 146 | return udp_dump_one(&udp_table, in_skb, nlh, req); |
147 | 147 | } |
148 | 148 | |
149 | +static void udp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | |
150 | + void *info) | |
151 | +{ | |
152 | + r->idiag_rqueue = sk_rmem_alloc_get(sk); | |
153 | + r->idiag_wqueue = sk_wmem_alloc_get(sk); | |
154 | +} | |
155 | + | |
149 | 156 | static const struct inet_diag_handler udp_diag_handler = { |
150 | 157 | .dump = udp_diag_dump, |
151 | 158 | .dump_one = udp_diag_dump_one, |
159 | + .idiag_get_info = udp_diag_get_info, | |
152 | 160 | .idiag_type = IPPROTO_UDP, |
153 | 161 | }; |
154 | 162 | |
... | ... | @@ -167,6 +175,7 @@ |
167 | 175 | static const struct inet_diag_handler udplite_diag_handler = { |
168 | 176 | .dump = udplite_diag_dump, |
169 | 177 | .dump_one = udplite_diag_dump_one, |
178 | + .idiag_get_info = udp_diag_get_info, | |
170 | 179 | .idiag_type = IPPROTO_UDPLITE, |
171 | 180 | }; |
172 | 181 |