From: Jakub Sitnicki <jakub@cloudflare.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Neal Cardwell <ncardwell@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
netdev@vger.kernel.org, kernel-team@cloudflare.com
Subject: Re: [PATCH net-next v3 3/3] selftests/net: Cover port sharing scenarios with IP_LOCAL_PORT_RANGE
Date: Thu, 17 Jul 2025 11:50:50 +0200 [thread overview]
Message-ID: <87ikjrdu2t.fsf@cloudflare.com> (raw)
In-Reply-To: <06e138e3-bb54-4219-b700-bf0a307a1b99@redhat.com> (Paolo Abeni's message of "Thu, 17 Jul 2025 11:34:02 +0200")
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.
prev parent reply other threads:[~2025-07-17 9:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 16:03 [PATCH net-next v3 0/3] tcp: Consider every port when connecting with IP_LOCAL_PORT_RANGE Jakub Sitnicki
2025-07-14 16:03 ` [PATCH net-next v3 1/3] tcp: Add RCU management to inet_bind2_bucket Jakub Sitnicki
2025-07-14 16:03 ` [PATCH net-next v3 2/3] tcp: Consider every port when connecting with IP_LOCAL_PORT_RANGE Jakub Sitnicki
2025-07-17 9:23 ` Paolo Abeni
2025-07-17 9:44 ` Jakub Sitnicki
2025-07-17 11:21 ` Jakub Sitnicki
2025-07-14 16:03 ` [PATCH net-next v3 3/3] selftests/net: Cover port sharing scenarios " Jakub Sitnicki
2025-07-17 9:27 ` Paolo Abeni
2025-07-17 9:44 ` Jakub Sitnicki
2025-07-17 9:34 ` Paolo Abeni
2025-07-17 9:50 ` Jakub Sitnicki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ikjrdu2t.fsf@cloudflare.com \
--to=jakub@cloudflare.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-team@cloudflare.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.