You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/01 09:26:23 UTC

[GitHub] [incubator-nuttx-apps] PetervdPerk-NXP opened a new pull request, #1245: Use thread-safe ntoa functions

PetervdPerk-NXP opened a new pull request, #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245

   ## Summary
   Depends on apache/incubator-nuttx#6751
   
   ## Impact
   Replaces ntoa by ntoa_r
   
   ## Testing
   See apache/incubator-nuttx#6751
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r934763764


##########
netutils/iperf/iperf.c:
##########
@@ -397,8 +399,9 @@ static int iperf_run_tcp_server(void)
           actual_recv = recv(sockfd, buffer, want_recv, 0);
           if (actual_recv == 0)
             {
+              char inetaddr[INET_ADDRSTRLEN + 2];

Review Comment:
   ```suggestion
                 char inetaddr[INET_ADDRSTRLEN];
   ```
   Should be fine



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#issuecomment-1204138776

   @PetervdPerk-NXP there are some errors, please fix it, thanks.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r934329134


##########
examples/ipcfg/ipcfg_main.c:
##########
@@ -281,8 +281,9 @@ static void ipcfg_dump_ipv4addr(FAR const char *variable, in_addr_t address)
       {
         address
       };
+      char inetaddr[INET_ADDRSTRLEN + 2];

Review Comment:
   ```suggestion
   
         char inetaddr[INET_ADDRSTRLEN + 2];
   ```



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#issuecomment-1202799657

   @PetervdPerk-NXP could you fix the remaining warning as much as possible?


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#issuecomment-1202295479

   Please squash commits


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r935725416


##########
wireless/wapi/src/wapi.c:
##########
@@ -913,6 +914,7 @@ static int wapi_reconnect_cmd(int sock, int argc, FAR char **argv)
 static int wapi_save_config_cmd(int sock, int argc, FAR char **argv)
 {
   char essid[WAPI_ESSID_MAX_SIZE + 1];
+  char bssid[INET_ADDRSTRLEN];

Review Comment:
   WiFi use the same MAC as Ethernet



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r935760557


##########
examples/discover/discover_main.c:
##########
@@ -136,6 +136,8 @@ int main(int argc, FAR char *argv[])
   if (handle)
     {
       struct dhcpc_state ds;
+      char inetaddr[INET_ADDRSTRLEN];
+ 

Review Comment:
   ```suggestion
   
   ```



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r935274831


##########
examples/bridge/bridge_main.c:
##########
@@ -165,7 +166,8 @@ static int briget_net1_setup(void)
     }
 
   dhcpc_close(handle);
-  printf("NET1: Assigned IP: %s\n", inet_ntoa(ds.ipaddr));
+  printf("NET1: Assigned IP: %s\n", inet_ntoa_r(ds.ipaddr, inetaddr,
+                                                sizeof(inetaddr)));

Review Comment:
   Optional
   ```suggestion
     printf("NET1: Assigned IP: %s\n", 
            net_ntoa_r(ds.ipaddr, inetaddr, sizeof(inetaddr)));
   ```



##########
examples/bridge/bridge_main.c:
##########
@@ -289,7 +292,8 @@ static int briget_net2_setup(void)
     }
 
   dhcpc_close(handle);
-  printf("NET1: Assigned IP: %s\n", inet_ntoa(ds.ipaddr));
+  printf("NET1: Assigned IP: %s\n", inet_ntoa_r(ds.ipaddr, inetaddr,
+                                                sizeof(inetaddr)));

Review Comment:
   Optional
   ```suggestion
     printf("NET1: Assigned IP: %s\n",
            inet_ntoa_r(ds.ipaddr, inetaddr, sizeof(inetaddr)));
   ```



##########
netutils/iperf/iperf.c:
##########
@@ -383,7 +383,9 @@ static int iperf_run_tcp_server(void)
         }
       else
         {
-          printf("accept: %s,%d\n", inet_ntoa(remote_addr.sin_addr),
+          char inetaddr[INET_ADDRSTRLEN];

Review Comment:
   ```suggestion
             char inetaddr[INET_ADDRSTRLEN];
   
   ```



##########
examples/webserver/webserver_main.c:
##########
@@ -165,6 +165,7 @@ int main(int argc, FAR char *argv[])
   if (handle)
     {
       struct dhcpc_state ds;
+      char inetaddr[INET_ADDRSTRLEN];

Review Comment:
   ```suggestion
         char inetaddr[INET_ADDRSTRLEN];
   
   ```



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -133,7 +138,8 @@ static char *xmlrpc_findbody(char *buf)
  *
  ****************************************************************************/
 
-static int xmlrpc_getheader(char *buffer, char *header, char *value, int size)
+static int xmlrpc_getheader(char *buffer, char *header,
+                            char *value, int size)
 {
   char *temp;

Review Comment:
   Not related to this PR, but will leave here for history
   ```suggestion
     FAR char *temp;
   ```



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -88,8 +87,14 @@
  * Private Data
  ****************************************************************************/
 
-static const char *notimplemented = { "HTTP/1.1 501 Not Implemented\n\n" };
-static const char *separator = { "\015\012\015\012" };
+static const char *notimplemented =
+{
+  "HTTP/1.1 501 Not Implemented\n\n"
+};
+static const char *separator =

Review Comment:
   Not related to this PR, but will leave here for history
   ```suggestion
   static const FAR char *separator =
   ```



##########
netutils/iperf/iperf.c:
##########
@@ -397,8 +399,9 @@ static int iperf_run_tcp_server(void)
           actual_recv = recv(sockfd, buffer, want_recv, 0);
           if (actual_recv == 0)
             {
+              char inetaddr[INET_ADDRSTRLEN];
               printf("closed by the peer: %s,%d\n",
-                     inet_ntoa(remote_addr.sin_addr),
+                     inet_ntoa_r(remote_addr.sin_addr, inetaddr),

Review Comment:
   size is missing



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -178,8 +184,15 @@ static void xmlrpc_handler(int fd)
 {
   fd_set rfds;
   struct timeval tv;
-  int ret, len, max = 0, loadlen = -1;
-  char buffer[CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE] = { 0 };
+  int ret;
+  int len;
+  int max = 0;
+  int loadlen = -1;
+  char buffer[CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE] =
+  {
+    0
+  };

Review Comment:
   ```suggestion
       {
         0
       };
   ```



##########
examples/ipcfg/ipcfg_main.c:
##########
@@ -282,7 +282,10 @@ static void ipcfg_dump_ipv4addr(FAR const char *variable, in_addr_t address)
         address
       };
 
-      printf("%s%s\n", variable, inet_ntoa(saddr));
+      char inetaddr[INET_ADDRSTRLEN];
+
+      printf("%s%s\n", variable, inet_ntoa_r(saddr, inetaddr,
+                                             sizeof(inetaddr)));

Review Comment:
   Optional
   ```suggestion
         printf("%s%s\n", variable,
                inet_ntoa_r(saddr, inetaddr, sizeof(inetaddr)));
   ```



##########
examples/discover/discover_main.c:
##########
@@ -138,6 +138,7 @@ int main(int argc, FAR char *argv[])
       struct dhcpc_state ds;
       dhcpc_request(handle, &ds);
       netlib_set_ipv4addr("eth0", &ds.ipaddr);
+      char inetaddr[INET_ADDRSTRLEN];

Review Comment:
   ```suggestion
         struct dhcpc_state ds;
         char inetaddr[INET_ADDRSTRLEN];
    
         dhcpc_request(handle, &ds);
         netlib_set_ipv4addr("eth0", &ds.ipaddr);
   ```



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -323,15 +335,16 @@ static int xmlrpc_netinit(void)
 
   handle = dhcpc_open("eth0", &mac, IFHWADDRLEN);
 
-  /* Get an IP address.  Note: there is no logic here for renewing the address
-   * in this example.  The address should be renewed in ds.lease_time/2
-   * seconds.
+  /* Get an IP address.  Note: there is no logic here for renewing the
+   * address in this example.  The address should be renewed in
+   * ds.lease_time/2 seconds.
    */
 
   printf("Getting IP address\n");
   if (handle)
     {
       struct dhcpc_state ds;
+      char inetaddr[INET_ADDRSTRLEN];

Review Comment:
   Optional
   ```suggestion
         char inetaddr[INET_ADDRSTRLEN];
   
   ```



##########
netutils/iperf/iperf.c:
##########
@@ -383,7 +383,9 @@ static int iperf_run_tcp_server(void)
         }
       else
         {
-          printf("accept: %s,%d\n", inet_ntoa(remote_addr.sin_addr),
+          char inetaddr[INET_ADDRSTRLEN];
+          printf("accept: %s,%d\n",
+                 inet_ntoa_r(remote_addr.sin_addr, inetaddr, sizeof(inetaddr)),

Review Comment:
   please fix



##########
wireless/wapi/src/wapi.c:
##########
@@ -913,6 +914,7 @@ static int wapi_reconnect_cmd(int sock, int argc, FAR char **argv)
 static int wapi_save_config_cmd(int sock, int argc, FAR char **argv)
 {
   char essid[WAPI_ESSID_MAX_SIZE + 1];
+  char bssid[INET_ADDRSTRLEN];

Review Comment:
   why `bssid` is `INET` and not `ETH`?



##########
nshlib/nsh_netcmds.c:
##########
@@ -1131,7 +1133,7 @@ int cmd_arp(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
           goto errout_cmdfaild;
         }
 
-      nsh_output(vtbl, "HWaddr: %s\n",  ether_ntoa(&mac));
+      nsh_output(vtbl, "HWaddr: %s\n",  ether_ntoa_r(&mac, hwaddr));

Review Comment:
   ```suggestion
         nsh_output(vtbl, "HWaddr: %s\n", ether_ntoa_r(&mac, hwaddr));
   ```



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -88,8 +87,14 @@
  * Private Data
  ****************************************************************************/
 
-static const char *notimplemented = { "HTTP/1.1 501 Not Implemented\n\n" };
-static const char *separator = { "\015\012\015\012" };
+static const char *notimplemented =
+{

Review Comment:
   Minor, optional: I think we can omit `{}`



##########
wireless/wapi/src/wapi.c:
##########
@@ -294,7 +295,7 @@ static int wapi_show_cmd(int sock, int argc, FAR char **argv)
     }
   else
     {
-      printf("  NetMask: %s\n", inet_ntoa(addr));
+      printf("  NetMask: %s\n", inet_ntoa_r(addr, inetaddr));

Review Comment:
   size is missing



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -88,8 +87,14 @@
  * Private Data
  ****************************************************************************/
 
-static const char *notimplemented = { "HTTP/1.1 501 Not Implemented\n\n" };
-static const char *separator = { "\015\012\015\012" };
+static const char *notimplemented =

Review Comment:
   Not related to this PR, but will leave here for history
   ```suggestion
   static const FAR char *notimplemented =
   ```



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -133,7 +138,8 @@ static char *xmlrpc_findbody(char *buf)
  *
  ****************************************************************************/
 
-static int xmlrpc_getheader(char *buffer, char *header, char *value, int size)
+static int xmlrpc_getheader(char *buffer, char *header,
+                            char *value, int size)

Review Comment:
   Not related to this PR, but will leave here for history
   ```suggestion
   static int xmlrpc_getheader(FAR char *buffer, FAR char *header,
                               FAR char *value, int size)
   ```



##########
examples/xmlrpc/xmlrpc_main.c:
##########
@@ -178,8 +184,15 @@ static void xmlrpc_handler(int fd)
 {
   fd_set rfds;
   struct timeval tv;
-  int ret, len, max = 0, loadlen = -1;
-  char buffer[CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE] = { 0 };
+  int ret;
+  int len;
+  int max = 0;
+  int loadlen = -1;
+  char buffer[CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE] =
+  {
+    0
+  };
+
   char value[CONFIG_XMLRPC_STRINGSIZE + 1];
   char *temp;

Review Comment:
   Not related to this PR, but will leave here for history
   ```suggestion
     FAR char *temp;
   ```



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r936919563


##########
examples/tcpecho/tcpecho_main.c:
##########
@@ -94,6 +94,7 @@ static int tcpecho_netsetup()
   struct dhcpc_state ds;
   void *handle;
 #endif
+  char inetaddr[INET_ADDRSTRLEN];

Review Comment:
   ```suggestion
     char inetaddr[INET_ADDRSTRLEN];
   #endif
   ```
   



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r935760154


##########
wireless/wapi/src/wapi.c:
##########
@@ -913,6 +914,7 @@ static int wapi_reconnect_cmd(int sock, int argc, FAR char **argv)
 static int wapi_save_config_cmd(int sock, int argc, FAR char **argv)
 {
   char essid[WAPI_ESSID_MAX_SIZE + 1];
+  char bssid[INET_ADDRSTRLEN];

Review Comment:
   Yes. `INET_ADDRSTRLEN` is for IP address, so it is changed to 20. 



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1245: Use thread-safe ntoa functions

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1245:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1245#discussion_r935373249


##########
examples/bridge/bridge_main.c:
##########
@@ -165,7 +166,8 @@ static int briget_net1_setup(void)
     }
 
   dhcpc_close(handle);
-  printf("NET1: Assigned IP: %s\n", inet_ntoa(ds.ipaddr));
+  printf("NET1: Assigned IP: %s\n", 

Review Comment:
   ```suggestion
     printf("NET1: Assigned IP: %s\n",
   ```



##########
examples/tcpecho/tcpecho_main.c:
##########
@@ -243,12 +244,14 @@ static int tcpecho_server(void)
 
       if (client[0].revents & POLLRDNORM)
         {
+          char inetaddr[INET_ADDRSTRLEN];
+
           /* new client connection */
 
           clilen = sizeof(cliaddr);
           connfd = accept(listenfd, (struct sockaddr *)&cliaddr, &clilen);
 
-          ninfo("new client: %s\n", inet_ntoa(cliaddr.sin_addr));
+          ninfo("new client: %s\n", inet_ntoa_r(cliaddr.sin_addr, inetaddr));

Review Comment:
   ```suggestion
             ninfo("new client: %s\n",
                   inet_ntoa_r(cliaddr.sin_addr, inetaddr, sizeof(inetaddr)));
   ```



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org