[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAN_72e31DHQn_a18HLYJ5hz8_HWL=x-D3BEDisyypU35=1h6XA@mail.gmail.com>
Date: Wed, 19 Feb 2020 16:40:14 -0800
From: Pavel Roskin <plroskin@...il.com>
To: David Miller <davem@...emloft.net>
Cc: willemdebruijn.kernel@...il.com, netdev@...r.kernel.org,
Eric Dumazet <edumazet@...gle.com>, willemb@...gle.com
Subject: Re: [PATCH net] udp: rehash on disconnect
On Wed, Feb 19, 2020 at 4:35 PM David Miller <davem@...emloft.net> wrote:
>
> From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
> Date: Wed, 19 Feb 2020 14:16:32 -0500
>
> > From: Willem de Bruijn <willemb@...gle.com>
> >
> > As of the below commit, udp sockets bound to a specific address can
> > coexist with one bound to the any addr for the same port.
> >
> > The commit also phased out the use of socket hashing based only on
> > port (hslot), in favor of always hashing on {addr, port} (hslot2).
> >
> > The change broke the following behavior with disconnect (AF_UNSPEC):
> >
> > 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 reads "hello" // times out, packet did not find sk
> >
> > On connect the server acquires a specific source addr suitable for
> > routing to its destination. On disconnect it reverts to the any addr.
> >
> > The connect call triggers a rehash to a different hslot2. On
> > disconnect, add the same to return to the original hslot2.
> >
> > Skip this step if the socket is going to be unhashed completely.
> >
> > Fixes: 4cdeeee9252a ("net: udp: prefer listeners bound to an address")
> > Reported-by: Pavel Roskin <plroskin@...il.com>
> > Signed-off-by: Willem de Bruijn <willemb@...gle.com>
>
> Applied and queued up for -stable, thanks Willem.
Successfully tested with the original server and the demo programs I posted.
Tested-by: Pavel Roskin <plroskin@...il.com>
--
Regards,
Pavel Roskin
Powered by blists - more mailing lists