* [PATCH net v2] udp: don't be set unconnected if only UDP cmsg
@ 2024-04-16 19:03 Yick Xie
2024-04-16 23:04 ` Willem de Bruijn
2024-04-18 10:32 ` Paolo Abeni
0 siblings, 2 replies; 7+ messages in thread
From: Yick Xie @ 2024-04-16 19:03 UTC (permalink / raw)
To: willemdebruijn.kernel, willemb
Cc: netdev, davem, dsahern, edumazet, kuba, pabeni, linux-kernel, stable
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.
Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
Signed-off-by: Yick Xie <yick.xie@gmail.com>
Cc: stable@vger.kernel.org
---
v2: Add Fixes tag
v1: https://lore.kernel.org/netdev/20240414195213.106209-1-yick.xie@gmail.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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v2] udp: don't be set unconnected if only UDP cmsg
2024-04-16 19:03 [PATCH net v2] udp: don't be set unconnected if only UDP cmsg Yick Xie
@ 2024-04-16 23:04 ` Willem de Bruijn
2024-04-18 10:32 ` Paolo Abeni
1 sibling, 0 replies; 7+ messages in thread
From: Willem de Bruijn @ 2024-04-16 23:04 UTC (permalink / raw)
To: Yick Xie, willemdebruijn.kernel, willemb
Cc: netdev, davem, dsahern, edumazet, kuba, pabeni, linux-kernel, stable
Yick Xie wrote:
> 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.
>
> Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
> Signed-off-by: Yick Xie <yick.xie@gmail.com>
> Cc: stable@vger.kernel.org
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v2] udp: don't be set unconnected if only UDP cmsg
2024-04-16 19:03 [PATCH net v2] udp: don't be set unconnected if only UDP cmsg Yick Xie
2024-04-16 23:04 ` Willem de Bruijn
@ 2024-04-18 10:32 ` Paolo Abeni
2024-04-18 13:52 ` Willem de Bruijn
1 sibling, 1 reply; 7+ messages in thread
From: Paolo Abeni @ 2024-04-18 10:32 UTC (permalink / raw)
To: Yick Xie, willemdebruijn.kernel, willemb
Cc: netdev, davem, dsahern, edumazet, kuba, linux-kernel, stable
Hi,
On Wed, 2024-04-17 at 03:03 +0800, Yick Xie wrote:
> 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.
>
> Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
> Signed-off-by: Yick Xie <yick.xie@gmail.com>
> Cc: stable@vger.kernel.org
Minor: the patch subj is IMHO a bit confusing, what about removing the
double negation?
preserve connect status with UDP-only cmsg
> ---
> v2: Add Fixes tag
> v1: https://lore.kernel.org/netdev/20240414195213.106209-1-yick.xie@gmail.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
What about ipv6? why this fix does not apply there, too?
Thanks!
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v2] udp: don't be set unconnected if only UDP cmsg
2024-04-18 10:32 ` Paolo Abeni
@ 2024-04-18 13:52 ` Willem de Bruijn
2024-04-18 17:06 ` [PATCH net v3] udp: preserve the connected status " Yick Xie
0 siblings, 1 reply; 7+ messages in thread
From: Willem de Bruijn @ 2024-04-18 13:52 UTC (permalink / raw)
To: Paolo Abeni, Yick Xie, willemdebruijn.kernel, willemb
Cc: netdev, davem, dsahern, edumazet, kuba, linux-kernel, stable
Paolo Abeni wrote:
> Hi,
>
> On Wed, 2024-04-17 at 03:03 +0800, Yick Xie wrote:
> > 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.
> >
> > Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
> > Signed-off-by: Yick Xie <yick.xie@gmail.com>
> > Cc: stable@vger.kernel.org
>
> Minor: the patch subj is IMHO a bit confusing, what about removing the
> double negation?
>
> preserve connect status with UDP-only cmsg
>
> > ---
> > v2: Add Fixes tag
> > v1: https://lore.kernel.org/netdev/20240414195213.106209-1-yick.xie@gmail.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
>
> What about ipv6? why this fix does not apply there, too?
Oops. Thanks Paolo. Yes, this definitely also applies to ipv6.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net v3] udp: preserve the connected status if only UDP cmsg
2024-04-18 13:52 ` Willem de Bruijn
@ 2024-04-18 17:06 ` Yick Xie
2024-04-18 19:38 ` Willem de Bruijn
2024-04-20 3:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 7+ messages in thread
From: Yick Xie @ 2024-04-18 17:06 UTC (permalink / raw)
To: willemdebruijn.kernel, willemb
Cc: netdev, davem, dsahern, edumazet, kuba, pabeni, linux-kernel, stable
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.
Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
Signed-off-by: Yick Xie <yick.xie@gmail.com>
Cc: stable@vger.kernel.org
---
v3: Fix the IPV6 counterpart and revise the subject
v2: Add Fixes tag
v1: https://lore.kernel.org/netdev/20240414195213.106209-1-yick.xie@gmail.com/
---
net/ipv4/udp.c | 5 +++--
net/ipv6/udp.c | 5 +++--
2 files changed, 6 insertions(+), 4 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;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8b1dd7f51249..1a4cccdd40c9 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1474,9 +1474,11 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
ipc6.opt = opt;
err = udp_cmsg_send(sk, msg, &ipc6.gso_size);
- if (err > 0)
+ if (err > 0) {
err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, fl6,
&ipc6);
+ connected = false;
+ }
if (err < 0) {
fl6_sock_release(flowlabel);
return err;
@@ -1488,7 +1490,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
}
if (!(opt->opt_nflen|opt->opt_flen))
opt = NULL;
- connected = false;
}
if (!opt) {
opt = txopt_get(np);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v3] udp: preserve the connected status if only UDP cmsg
2024-04-18 17:06 ` [PATCH net v3] udp: preserve the connected status " Yick Xie
@ 2024-04-18 19:38 ` Willem de Bruijn
2024-04-20 3:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 7+ messages in thread
From: Willem de Bruijn @ 2024-04-18 19:38 UTC (permalink / raw)
To: Yick Xie, willemdebruijn.kernel, willemb
Cc: netdev, davem, dsahern, edumazet, kuba, pabeni, linux-kernel, stable
Yick Xie wrote:
> 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.
>
> Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
> Signed-off-by: Yick Xie <yick.xie@gmail.com>
> Cc: stable@vger.kernel.org
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v3] udp: preserve the connected status if only UDP cmsg
2024-04-18 17:06 ` [PATCH net v3] udp: preserve the connected status " Yick Xie
2024-04-18 19:38 ` Willem de Bruijn
@ 2024-04-20 3:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-20 3:30 UTC (permalink / raw)
To: Yick Xie
Cc: willemdebruijn.kernel, willemb, netdev, davem, dsahern, edumazet,
kuba, pabeni, linux-kernel, stable
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 19 Apr 2024 01:06:10 +0800 you wrote:
> 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.
>
> Fixes: 2e8de8576343 ("udp: add gso segment cmsg")
> Signed-off-by: Yick Xie <yick.xie@gmail.com>
> Cc: stable@vger.kernel.org
>
> [...]
Here is the summary with links:
- [net,v3] udp: preserve the connected status if only UDP cmsg
https://git.kernel.org/netdev/net/c/680d11f6e542
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-20 3:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16 19:03 [PATCH net v2] udp: don't be set unconnected if only UDP cmsg Yick Xie
2024-04-16 23:04 ` Willem de Bruijn
2024-04-18 10:32 ` Paolo Abeni
2024-04-18 13:52 ` Willem de Bruijn
2024-04-18 17:06 ` [PATCH net v3] udp: preserve the connected status " Yick Xie
2024-04-18 19:38 ` Willem de Bruijn
2024-04-20 3:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).