[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06e138e3-bb54-4219-b700-bf0a307a1b99@redhat.com>
Date: Thu, 17 Jul 2025 11:34:02 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Jakub Sitnicki <jakub@...udflare.com>, 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>
Cc: 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 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).
/P
Powered by blists - more mailing lists