This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit a9ac523282f43a2d16c8d3f16202076c662f8545
Author: Marco Casaroli <[email protected]>
AuthorDate: Sun Nov 8 19:14:34 2026 +0100

    netutils/iperf: Initialize the SO_REUSEADDR value.
    
    The TCP server, the UDP server and the UDP client passed an int opt that
    was never set to setsockopt(SO_REUSEADDR).  The option then got a value
    from the stack, so address reuse was on or off by chance.  clang reports
    this with -Wuninitialized-const-pointer, which breaks a -Werror build.
    
    Set opt to 1, so that address reuse is always on.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 netutils/iperf/iperf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/netutils/iperf/iperf.c b/netutils/iperf/iperf.c
index 6395157f0..7fc1f94b3 100644
--- a/netutils/iperf/iperf.c
+++ b/netutils/iperf/iperf.c
@@ -498,7 +498,7 @@ static int iperf_tcp_server(FAR struct iperf_ctrl_t *ctrl,
   int listen_socket;
   struct timeval t;
   int sockfd;
-  int opt;
+  int opt = 1;
 
   listen_socket = socket(addr->sa_family, SOCK_STREAM, IPPROTO_TCP);
   if (listen_socket < 0)
@@ -611,7 +611,7 @@ static int iperf_udp_server(FAR struct iperf_ctrl_t *ctrl,
   int want_recv = 0;
   FAR uint8_t *buffer;
   int sockfd;
-  int opt;
+  int opt = 1;
   bool udp_recv_start = true;
 
   sockfd = socket(addr->sa_family, SOCK_DGRAM, IPPROTO_UDP);
@@ -695,7 +695,7 @@ static int iperf_udp_client(FAR struct iperf_ctrl_t *ctrl,
   int want_send = 0;
   uint8_t *buffer;
   int sockfd;
-  int opt;
+  int opt = 1;
   int err;
   int id;
 

Reply via email to