* [PATCH v1 net-next] selftest: net: Use port outside of the default ip_local_ports in csum.c.
@ 2026-04-10 21:54 Kuniyuki Iwashima
2026-04-11 19:18 ` Willem de Bruijn
0 siblings, 1 reply; 2+ messages in thread
From: Kuniyuki Iwashima @ 2026-04-10 21:54 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Willem de Bruijn, Mahesh Bandewar,
Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
csum.c binds a socket on a fixed port in init_net to test
the csum offload feature between two machines.
In our testbed, the test sometimes fails with -EADDRINUSE.
bind r: Address already in use
bind dgram 6: Address already in use
The fixed ports (33000, 33001, 34000) are all within the default
ip_local_ports range (32768 ~ 60999), and other processes may
happen to be using them.
Let's use ports outside of the default ip_local_ports range to
deflake the test.
# cat /etc/services | grep -E "(13000|13001|13002)" | echo no service
no service
# rpm -qf /etc/services
setup-2.15.0-28.fc44.noarch
We could add an option to specify ports if needed.
Suggested-by: Mahesh Bandewar <maheshb@google.com>
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
tools/testing/selftests/net/lib/csum.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/lib/csum.c b/tools/testing/selftests/net/lib/csum.c
index e28884ce3ab3..4e044689bc37 100644
--- a/tools/testing/selftests/net/lib/csum.c
+++ b/tools/testing/selftests/net/lib/csum.c
@@ -105,9 +105,9 @@ static char *cfg_mac_src;
static int cfg_proto = IPPROTO_UDP;
static int cfg_payload_char = 'a';
static int cfg_payload_len = 100;
-static uint16_t cfg_port_dst = 34000;
-static uint16_t cfg_port_src = 33000;
-static uint16_t cfg_port_src_encap = 33001;
+static uint16_t cfg_port_dst = 13000;
+static uint16_t cfg_port_src = 13001;
+static uint16_t cfg_port_src_encap = 13002;
static unsigned int cfg_random_seed;
static int cfg_rcvbuf = 1 << 22; /* be able to queue large cfg_num_pkt */
static bool cfg_send_pfpacket;
--
2.53.0.1213.gd9a14994de-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 net-next] selftest: net: Use port outside of the default ip_local_ports in csum.c.
2026-04-10 21:54 [PATCH v1 net-next] selftest: net: Use port outside of the default ip_local_ports in csum.c Kuniyuki Iwashima
@ 2026-04-11 19:18 ` Willem de Bruijn
0 siblings, 0 replies; 2+ messages in thread
From: Willem de Bruijn @ 2026-04-11 19:18 UTC (permalink / raw)
To: Kuniyuki Iwashima, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
Cc: Simon Horman, Willem de Bruijn, Mahesh Bandewar,
Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
Kuniyuki Iwashima wrote:
> csum.c binds a socket on a fixed port in init_net to test
> the csum offload feature between two machines.
>
> In our testbed, the test sometimes fails with -EADDRINUSE.
>
> bind r: Address already in use
> bind dgram 6: Address already in use
>
> The fixed ports (33000, 33001, 34000) are all within the default
> ip_local_ports range (32768 ~ 60999), and other processes may
> happen to be using them.
>
> Let's use ports outside of the default ip_local_ports range to
> deflake the test.
>
> # cat /etc/services | grep -E "(13000|13001|13002)" | echo no service
> no service
> # rpm -qf /etc/services
> setup-2.15.0-28.fc44.noarch
>
> We could add an option to specify ports if needed.
>
> Suggested-by: Mahesh Bandewar <maheshb@google.com>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
> ---
> tools/testing/selftests/net/lib/csum.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/lib/csum.c b/tools/testing/selftests/net/lib/csum.c
> index e28884ce3ab3..4e044689bc37 100644
> --- a/tools/testing/selftests/net/lib/csum.c
> +++ b/tools/testing/selftests/net/lib/csum.c
> @@ -105,9 +105,9 @@ static char *cfg_mac_src;
> static int cfg_proto = IPPROTO_UDP;
> static int cfg_payload_char = 'a';
> static int cfg_payload_len = 100;
> -static uint16_t cfg_port_dst = 34000;
This is paired with wait_port_listen(3400, .. in
tools/testing/selftests/drivers/net/hw/csum.py
It is also used in tools/testing/selftests/drivers/net/hw/tso.py,
which uses rand_port to select a port.
Probably more robust to indeed add an option to specify a port, and
in all callers use rand_port(s).
> -static uint16_t cfg_port_src = 33000;
> -static uint16_t cfg_port_src_encap = 33001;
> +static uint16_t cfg_port_dst = 13000;
> +static uint16_t cfg_port_src = 13001;
> +static uint16_t cfg_port_src_encap = 13002;
> static unsigned int cfg_random_seed;
> static int cfg_rcvbuf = 1 << 22; /* be able to queue large cfg_num_pkt */
> static bool cfg_send_pfpacket;
> --
> 2.53.0.1213.gd9a14994de-goog
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-11 19:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 21:54 [PATCH v1 net-next] selftest: net: Use port outside of the default ip_local_ports in csum.c Kuniyuki Iwashima
2026-04-11 19:18 ` Willem de Bruijn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox