nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aguettou...@apache.org
Subject [incubator-nuttx-apps] 04/04: examples/udp: Avoid using non-standard s6_addr16
Date Thu, 02 Apr 2020 10:40:11 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 97b439f180a74543a5cc5558f35e0f5e984ce172
Author: YAMAMOTO Takashi <yamamoto@midokura.com>
AuthorDate: Thu Apr 2 01:35:15 2020 +0900

    examples/udp: Avoid using non-standard s6_addr16
    
    Also, fixes endian issues.
---
 examples/udp/udp_server.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/examples/udp/udp_server.c b/examples/udp/udp_server.c
index 0237be3..cc9b053 100644
--- a/examples/udp/udp_server.c
+++ b/examples/udp/udp_server.c
@@ -168,12 +168,18 @@ void udp_server(void)
                         (struct sockaddr *)&client, &recvlen);
 
 #ifdef CONFIG_EXAMPLES_UDP_IPv6
-      printf("server: %d. Received %d bytes from %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x
port %d\n",
+      printf("server: %d. Received %d bytes from "
+             "%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
+             "%02x%02x:%02x%02x:%02x%02x:%02x%02x port %d\n",
              offset, nbytes,
-             client.sin6_addr.s6_addr16[0], client.sin6_addr.s6_addr16[1],
-             client.sin6_addr.s6_addr16[2], client.sin6_addr.s6_addr16[3],
-             client.sin6_addr.s6_addr16[4], client.sin6_addr.s6_addr16[5],
-             client.sin6_addr.s6_addr16[6], client.sin6_addr.s6_addr16[7],
+             client.sin6_addr.s6_addr[0], client.sin6_addr.s6_addr[1],
+             client.sin6_addr.s6_addr[2], client.sin6_addr.s6_addr[3],
+             client.sin6_addr.s6_addr[4], client.sin6_addr.s6_addr[5],
+             client.sin6_addr.s6_addr[6], client.sin6_addr.s6_addr[7],
+             client.sin6_addr.s6_addr[8], client.sin6_addr.s6_addr[9],
+             client.sin6_addr.s6_addr[10], client.sin6_addr.s6_addr[11],
+             client.sin6_addr.s6_addr[12], client.sin6_addr.s6_addr[13],
+             client.sin6_addr.s6_addr[14], client.sin6_addr.s6_addr[15],
              ntohs(client.sin6_port));
 #else
       tmpaddr = ntohl(client.sin_addr.s_addr);


Mime
View raw message