[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170621213631.145600-1-tracywwnj@gmail.com>
Date: Wed, 21 Jun 2017 14:36:31 -0700
From: Wei Wang <tracywwnj@...il.com>
To: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>
Cc: Maciej Żenczykowski <maze@...gle.com>,
Wei Wang <weiwan@...gle.com>
Subject: [PATCH net] udp: ipv6: reset daddr and dport in sk if connect() fails
From: Wei Wang <weiwan@...gle.com>
In __ip6_datagram_connect(), reset sk->sk_v6_daddr and inet->dport if
error occurs so that udp_v6_early_demux() won't be able to do exact match on
this socket and hence, won't consider this socket as a valid candidate for
early demux.
Signed-off-by: Wei Wang <weiwan@...gle.com>
Acked-by: Maciej Żenczykowski <maze@...gle.com>
---
net/ipv6/datagram.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index e011122ebd43..f43f4f1e69dd 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -250,8 +250,14 @@ int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr,
*/
err = ip6_datagram_dst_update(sk, true);
- if (err)
+ if (err) {
+ /* Reset daddr and dport so that udp_v6_early_demux()
+ * fails to find this socket
+ */
+ memset(&sk->sk_v6_daddr, 0 sizeof(sk->sk_v6_daddr);
+ inet->inet_dport = 0;
goto out;
+ }
sk->sk_state = TCP_ESTABLISHED;
sk_set_txhash(sk);
--
2.13.1.611.g7e3b11ae1-goog
Powered by blists - more mailing lists