lkml.org 
[lkml]   [2022]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PULL] Networking for next-6.1
From
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.

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

\
 
 \ /
  Last update: 2022-12-16 11:49    [W:0.091 / U:1.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site