acassis commented on code in PR #8297:
URL: https://github.com/apache/nuttx/pull/8297#discussion_r1089307963


##########
net/tcp/tcp_conn.c:
##########
@@ -1242,7 +1242,14 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const 
struct sockaddr *addr)
 
       /* The sockaddr address is 32-bits in network order. */
 
-      net_ipv4addr_copy(conn->u.ipv4.raddr, inaddr->sin_addr.s_addr);
+      if (inaddr->sin_addr.s_addr == INADDR_ANY)
+        {
+          net_ipv4addr_copy(conn->u.ipv4.raddr, HTONL(INADDR_LOOPBACK));
+        }
+      else
+        {
+          net_ipv4addr_copy(conn->u.ipv4.raddr, inaddr->sin_addr.s_addr);
+        }

Review Comment:
   So, 0.0.0.0 means 127.0.0.1? Is that the idea? Maybe should be a good idea 
include a comment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to