[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240414195213.106209-1-yick.xie@gmail.com>
Date: Mon, 15 Apr 2024 03:52:13 +0800
From: Yick Xie <yick.xie@...il.com>
To: willemdebruijn.kernel@...il.com,
willemb@...gle.com
Cc: netdev@...r.kernel.org,
davem@...emloft.net
Subject: [PATCH net] udp: don't be set unconnected if only UDP cmsg
If "udp_cmsg_send()" returned 0 (i.e. only UDP cmsg),
"connected" should not be set to 0. Otherwise it stops
the connected socket from using the cached route.
Signed-off-by: Yick Xie <yick.xie@...il.com>
---
net/ipv4/udp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index c02bf011d4a6..420905be5f30 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1123,16 +1123,17 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (msg->msg_controllen) {
err = udp_cmsg_send(sk, msg, &ipc.gso_size);
- if (err > 0)
+ if (err > 0) {
err = ip_cmsg_send(sk, msg, &ipc,
sk->sk_family == AF_INET6);
+ connected = 0;
+ }
if (unlikely(err < 0)) {
kfree(ipc.opt);
return err;
}
if (ipc.opt)
free = 1;
- connected = 0;
}
if (!ipc.opt) {
struct ip_options_rcu *inet_opt;
--
2.34.1
Powered by blists - more mailing lists