[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ikjrdu2t.fsf@cloudflare.com>
Date: Thu, 17 Jul 2025 11:50:50 +0200
From: Jakub Sitnicki <jakub@...udflare.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Eric Dumazet <edumazet@...gle.com>, "David S. Miller"
<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Neal Cardwell
<ncardwell@...gle.com>, Kuniyuki Iwashima <kuniyu@...gle.com>,
netdev@...r.kernel.org, kernel-team@...udflare.com
Subject: Re: [PATCH net-next v3 3/3] selftests/net: Cover port sharing
scenarios with IP_LOCAL_PORT_RANGE
On Thu, Jul 17, 2025 at 11:34 AM +02, Paolo Abeni wrote:
> On 7/14/25 6:03 PM, Jakub Sitnicki wrote:
>> diff --git a/tools/testing/selftests/net/ip_local_port_range.c b/tools/testing/selftests/net/ip_local_port_range.c
>> index 29451d2244b7..d5ff64c14132 100644
>> --- a/tools/testing/selftests/net/ip_local_port_range.c
>> +++ b/tools/testing/selftests/net/ip_local_port_range.c
>> @@ -9,6 +9,7 @@
>>
>> #include <fcntl.h>
>> #include <netinet/ip.h>
>> +#include <arpa/inet.h>
>>
>> #include "../kselftest_harness.h"
>>
>> @@ -20,6 +21,15 @@
>> #define IPPROTO_MPTCP 262
>> #endif
>>
>> +static const int ONE = 1;
>> +
>> +__attribute__((nonnull)) static inline void close_fd(int *fd)
>
> Please no inline functions in c files.
>
>> +{
>> + close(*fd);
>> +}
>> +
>> +#define __close_fd __attribute__((cleanup(close_fd)))
>
> I almost missed this. IMHO it's a little overkill and the macro
> definition foul the static checker:
>
> WARNING: Missing a blank line after declarations
> #181: FILE: tools/testing/selftests/net/ip_local_port_range.c:588:
> + struct sockaddr_inet addr;
> + __close_fd int ln = -1;
>
> You could either use the fixture teardown, or simply close the fds at
> test end, ignoring the error paths (fds will be closed at exit time).
Not a problem. Will switch to managing FDs the classic way.
Powered by blists - more mailing lists