[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADaRJKtHCvBH_GJkqF2+NjaLg6uzo4-8s6YDuzT=HzJdDM4hHg@mail.gmail.com>
Date: Fri, 12 Apr 2024 01:53:27 +0800
From: Yick Xie <yick.xie@...il.com>
To: willemb@...gle.com, davem@...emloft.net, willemdebruijn.kernel@...il.com
Cc: netdev@...r.kernel.org
Subject: [BUG report] GSO cmsg always turns UDP into unconnected
Greetings,
If "udp_cmsg_send()" returned 0 (i.e. only SOL_UDP cmsg), "connected"
would still be set to 0, later inevitably "ip_route_output_flow()".
In other words, a connected UDP works as unconnected.
A potential fix like this:
```
https://github.com/torvalds/linux/blob/20cb38a7af88dc40095da7c2c9094da3873fea23/net/ipv4/udp.c#L1043
@@ 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;
}
```
Powered by blists - more mailing lists