[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAN_72e2m8ZYTu1wsqHabvHct8d0Ftf6VHrh-ZGJNR0-Bpa2cyw@mail.gmail.com>
Date: Sun, 16 Feb 2020 10:52:37 -0800
From: Pavel Roskin <plroskin@...il.com>
To: netdev@...r.kernel.org, Peter Oskolkov <posk@...gle.com>,
Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>
Subject: [BISECTED] UDP socket bound to addr_any receives no data after disconnect
Hello,
I was debugging a program that uses UDP to serve one client at a time.
It stopped working on newer Linux versions. I was able to bisect the
issue to commit 4cdeeee9252af1ba50482f91d615f326365306bd, "net: udp:
prefer listeners bound to an address". The commit is present in Linux
5.0 but not in 4.20. Linux 5.5.4 is still affected.
>From reading the commit description, it doesn't appear that the effect
is intended. However, I found that the issue goes away if I bind the
socket to the loopback address.
I wrote a demo program that shows the problem:
server binds to 0.0.0.0:1337
server connects to 127.0.0.1:80
server disconnects
client connects to 127.0.0.1:1337
client sends "hello"
server gets nothing
Load a 4.x kernel, and the server would get "hello". Likewise, change
"0.0.0.0" to "127.0.0.1" and the problem goes away.
IPv6 has the same issue. I'm attaching programs that demonstrate the
issue with IPv4 and IPv6. They print "hello" on success and hang
otherwise.
--
Regards,
Pavel Roskin
View attachment "udp_demo6.c" of type "text/x-csrc" (1603 bytes)
View attachment "udp_demo4.c" of type "text/x-csrc" (1601 bytes)
Powered by blists - more mailing lists