Messages in this thread | | | From | Kuniyuki Iwashima <> | Subject | Re: [PULL] Networking for next-6.1 | Date | Mon, 19 Dec 2022 08:25:47 +0900 |
| |
From: Jiri Slaby <jirislaby@kernel.org> Date: Fri, 16 Dec 2022 11:49:01 +0100 > Hi, > > On 04. 10. 22, 7:20, Jakub Kicinski wrote: > > Joanne Koong (7): > > > net: Add a bhash2 table hashed by port and address > > This makes regression tests of python-ephemeral-port-reserve to fail. > > I'm not sure if the issue is in the commit or in the test.
Hi Jiri,
Thanks for reporting the issue.
It seems we forgot to add TIME_WAIT sockets into bhash2 in inet_twsk_hashdance(), therefore inet_bhash2_conflict() misses TIME_WAIT sockets when validating bind() requests if the address is not a wildcard one.
I'll fix it.
Thank you.
> > This C reproducer used to fail with 6.0, now it succeeds: > #include <err.h> > #include <errno.h> > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > #include <unistd.h> > > #include <sys/socket.h> > > #include <arpa/inet.h> > #include <netinet/ip.h> > > int main() > { > int x; > int s1 = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_IP); > if (s1 < 0) > err(1, "sock1"); > x = 1; > if (setsockopt(s1, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x))) > err(1, "setsockopt1"); > > struct sockaddr_in in = { > .sin_family = AF_INET, > .sin_port = INADDR_ANY, > .sin_addr = { htonl(INADDR_LOOPBACK) }, > }; > if (bind(s1, (const struct sockaddr *)&in, sizeof(in)) < 0) > err(1, "bind1"); > > if (listen(s1, 1) < 0) > err(1, "listen1"); > > socklen_t inl = sizeof(in); > if (getsockname(s1, (struct sockaddr *)&in, &inl) < 0) > err(1, "getsockname1"); > > int s2 = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_IP); > if (s1 < 0) > err(1, "sock2"); > > if (connect(s2, (struct sockaddr *)&in, inl) < 0) > err(1, "conn2"); > > struct sockaddr_in acc; > inl = sizeof(acc); > int fdX = accept(s1, (struct sockaddr *)&acc, &inl); > if (fdX < 0) > err(1, "accept"); > > close(fdX); > close(s2); > close(s1); > > int s3 = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, IPPROTO_IP); > if (s3 < 0) > err(1, "sock3"); > > if (bind(s3, (struct sockaddr *)&in, sizeof(in)) < 0) > err(1, "bind3"); > > close(s3); > > return 0; > } > > > > thanks, > -- > js > suse labs
| |