From: Yick Xie <yick.xie@gmail.com>
To: willemb@google.com, davem@davemloft.net, willemdebruijn.kernel@gmail.com
Cc: netdev@vger.kernel.org
Subject: [BUG report] GSO cmsg always turns UDP into unconnected
Date: Fri, 12 Apr 2024 01:53:27 +0800 [thread overview]
Message-ID: <CADaRJKtHCvBH_GJkqF2+NjaLg6uzo4-8s6YDuzT=HzJdDM4hHg@mail.gmail.com> (raw)
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;
}
```
next reply other threads:[~2024-04-11 17:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 17:53 Yick Xie [this message]
2024-04-11 21:30 ` [BUG report] GSO cmsg always turns UDP into unconnected Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADaRJKtHCvBH_GJkqF2+NjaLg6uzo4-8s6YDuzT=HzJdDM4hHg@mail.gmail.com' \
--to=yick.xie@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.