* [PATCH net-next] sock_diag: fetch source port from inet_sock
@ 2015-06-17 14:59 Craig Gallek
2015-06-21 17:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Craig Gallek @ 2015-06-17 14:59 UTC (permalink / raw)
To: netdev; +Cc: edumazet, davem, Craig Gallek
When an inet_sock is destroyed, its source port (sk_num) is set to
zero as part of the unhash procedure. In order to supply a source
port as part of the NETLINK_SOCK_DIAG socket destruction broadcasts,
the source port number must be read from inet_sport instead.
Tested: ss -E
Signed-off-by: Craig Gallek <kraig@google.com>
---
net/ipv4/inet_diag.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 21985d8..ba6a80f 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -1095,6 +1095,8 @@ int inet_diag_handler_get_info(struct sk_buff *skb, struct sock *sk)
r = nlmsg_data(nlh);
memset(r, 0, sizeof(*r));
inet_diag_msg_common_fill(r, sk);
+ if (sk->sk_type == SOCK_DGRAM || sk->sk_type == SOCK_STREAM)
+ r->id.idiag_sport = inet_sk(sk)->inet_sport;
r->idiag_state = sk->sk_state;
if ((err = nla_put_u8(skb, INET_DIAG_PROTOCOL, sk->sk_protocol))) {
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] sock_diag: fetch source port from inet_sock
2015-06-17 14:59 [PATCH net-next] sock_diag: fetch source port from inet_sock Craig Gallek
@ 2015-06-21 17:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-06-21 17:17 UTC (permalink / raw)
To: kraig; +Cc: netdev, edumazet
From: Craig Gallek <kraig@google.com>
Date: Wed, 17 Jun 2015 10:59:10 -0400
> When an inet_sock is destroyed, its source port (sk_num) is set to
> zero as part of the unhash procedure. In order to supply a source
> port as part of the NETLINK_SOCK_DIAG socket destruction broadcasts,
> the source port number must be read from inet_sport instead.
>
> Tested: ss -E
> Signed-off-by: Craig Gallek <kraig@google.com>
Applied but it seems very hackish and not very long term maintainable
to do things this way.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-21 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 14:59 [PATCH net-next] sock_diag: fetch source port from inet_sock Craig Gallek
2015-06-21 17:17 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.