On Thu Oct 30, 2025 at 5:21 PM CET, Martin KaFai Lau wrote:
> On 10/30/25 7:04 AM, Alexis Lothoré wrote:
>>>> +  int family = cfg->ipproto == 6 ? AF_INET6 : AF_INET;
>>>> +
>>>> +  cfg->server_fd = start_reuseport_server(family, SOCK_STREAM,
>>>> +                                          cfg->server_addr, TEST_PORT,
>>>> +                                          TIMEOUT_MS, 1);
>>>
>>> Why reuseport is needed? Does it have issue in bind() to the same
>>> ip/port in the later sub-test?
>> 
>> Yes, I observed that is I use the bare start_server, I systematically have
>> the first test passing, an all the others failing on the server startup
>> with errno 98 (Address already in use). I have been assuming that it is due
>> to some TIME_WAIT state on the freshly closed socket, but I may be missing
>> something ?
>
> Thanks for confirming. You are right. It should be the TIME_WAIT. Using 
> SO_REUSEPORT works but become confusing on what the test is trying to do 
> by starting only 1 reuseport server. reuseport is usually used with >1 
> server listening on the same address. A better thing to do is to always 
> setsockopt(SO_REUSEADDR) in start_server_addr for TCP.

Sure, I can go for start_server_addr + SO_REUSEADDR :) I'll add it as well
in the incoming follow-up series, next to the missing open_netns checks.

Thanks,

Alexis

-- 
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Reply via email to