From 76a7272bad960a5d5abb6ec09a1aebc1e5fad1a5 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 20 Jan 2015 18:14:09 -0600 Subject: Correct name of fields in struct sockaddr_in6: sin6_port and sin6_family, not sin_port and sin_family --- apps/netutils/dnsclient/dns_socket.c | 9 +++-- apps/netutils/netlib/netlib_setdripv6addr.c | 6 +-- apps/netutils/netlib/netlib_setipv6addr.c | 6 +-- apps/netutils/netlib/netlib_setipv6netmask.c | 6 +-- apps/nshlib/Kconfig | 56 ++++++++++++---------------- apps/nshlib/nsh_mntcmds.c | 4 +- apps/nshlib/nsh_routecmds.c | 26 ++++++------- nuttx/include/netinet/in.h | 4 +- nuttx/net/netdev/netdev_ioctl.c | 8 ++-- nuttx/net/socket/accept.c | 4 +- nuttx/net/socket/getsockname.c | 14 +++---- nuttx/net/socket/recvfrom.c | 8 ++-- nuttx/net/tcp/tcp_conn.c | 8 ++-- nuttx/net/udp/udp_conn.c | 4 +- 14 files changed, 79 insertions(+), 84 deletions(-) diff --git a/apps/netutils/dnsclient/dns_socket.c b/apps/netutils/dnsclient/dns_socket.c index 76cf64a33..693aae7f7 100644 --- a/apps/netutils/dnsclient/dns_socket.c +++ b/apps/netutils/dnsclient/dns_socket.c @@ -546,12 +546,15 @@ void dns_setserver(FAR const struct in6_addr *dnsserver) void dns_setserver(FAR const struct in_addr *dnsserver) #endif { - g_dnsserver.sin_family = AF_INET; - g_dnsserver.sin_port = HTONS(53); - #ifdef CONFIG_NETUTILS_DNSCLIENT_IPv6 + g_dnsserver.sin6_family = AF_INET6; + g_dnsserver.sin6_port = HTONS(53); + memcpy(&g_dnsserver.sin6_addr, dnsserver, ADDRLEN); #else + g_dnsserver.sin_family = AF_INET; + g_dnsserver.sin_port = HTONS(53); + g_dnsserver.sin_addr.s_addr = dnsserver->s_addr; #endif } diff --git a/apps/netutils/netlib/netlib_setdripv6addr.c b/apps/netutils/netlib/netlib_setdripv6addr.c index d339e6b87..aed620b0b 100644 --- a/apps/netutils/netlib/netlib_setdripv6addr.c +++ b/apps/netutils/netlib/netlib_setdripv6addr.c @@ -90,9 +90,9 @@ int netlib_set_dripv6addr(FAR const char *ifname, /* Add the INET address to the request */ - inaddr = (FAR struct sockaddr_in6 *)&req.lifr_addr; - inaddr->sin_family = AF_INET6; - inaddr->sin_port = 0; + inaddr = (FAR struct sockaddr_in6 *)&req.lifr_addr; + inaddr->sin6_family = AF_INET6; + inaddr->sin6_port = 0; memcpy(&inaddr->sin6_addr, addr, sizeof(struct in6_addr)); ret = ioctl(sockfd, SIOCSLIFDSTADDR, (unsigned long)((uintptr_t)&req)); diff --git a/apps/netutils/netlib/netlib_setipv6addr.c b/apps/netutils/netlib/netlib_setipv6addr.c index 8a5d8be80..e4d4c179a 100644 --- a/apps/netutils/netlib/netlib_setipv6addr.c +++ b/apps/netutils/netlib/netlib_setipv6addr.c @@ -90,9 +90,9 @@ int netlib_set_ipv6addr(FAR const char *ifname, /* Add the INET address to the request */ - inaddr = (FAR struct sockaddr_in6 *)&req.lifr_addr; - inaddr->sin_family = AF_INET6; - inaddr->sin_port = 0; + inaddr = (FAR struct sockaddr_in6 *)&req.lifr_addr; + inaddr->sin6_family = AF_INET6; + inaddr->sin6_port = 0; memcpy(&inaddr->sin6_addr, addr, sizeof(struct in6_addr)); ret = ioctl(sockfd, SIOCSLIFADDR, ((unsigned long)(uintptr_t)&req)); diff --git a/apps/netutils/netlib/netlib_setipv6netmask.c b/apps/netutils/netlib/netlib_setipv6netmask.c index f092790a2..fc9d67f37 100644 --- a/apps/netutils/netlib/netlib_setipv6netmask.c +++ b/apps/netutils/netlib/netlib_setipv6netmask.c @@ -89,9 +89,9 @@ int netlib_set_ipv6netmask(FAR const char *ifname, /* Add the INET address to the request */ - inaddr = (FAR struct sockaddr_in6 *)&req.lifr_addr; - inaddr->sin_family = AF_INET6; - inaddr->sin_port = 0; + inaddr = (FAR struct sockaddr_in6 *)&req.lifr_addr; + inaddr->sin6_family = AF_INET6; + inaddr->sin6_port = 0; memcpy(&inaddr->sin6_addr, addr, sizeof(struct in6_addr)); ret = ioctl(sockfd, SIOCSLIFNETMASK, (unsigned long)((uintptr_t)&req)); diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index dd4676a59..3805ffff4 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -944,7 +944,7 @@ config NSH_IPv6ADDR_1 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the first of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. config NSH_IPv6ADDR_2 hex "[1]" @@ -955,7 +955,7 @@ config NSH_IPv6ADDR_2 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the second of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. config NSH_IPv6ADDR_3 hex "[2]" @@ -966,7 +966,7 @@ config NSH_IPv6ADDR_3 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the third of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. config NSH_IPv6ADDR_4 hex "[3]" @@ -977,7 +977,7 @@ config NSH_IPv6ADDR_4 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the fourth of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. config NSH_IPv6ADDR_5 hex "[4]" @@ -988,7 +988,7 @@ config NSH_IPv6ADDR_5 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the fifth of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. config NSH_IPv6ADDR_6 hex "[5]" @@ -999,7 +999,7 @@ config NSH_IPv6ADDR_6 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the sixth of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. config NSH_IPv6ADDR_7 hex "[6]" @@ -1010,7 +1010,7 @@ config NSH_IPv6ADDR_7 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the seventh of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. config NSH_IPv6ADDR_8 hex "[7]" @@ -1021,7 +1021,7 @@ config NSH_IPv6ADDR_8 provided. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the last of the 8-values. The default for - all eight values is fc00:0000:0000:0000:0000:0000:0000:0002. + all eight values is fc00::2. endif # !NSH_DHCPC @@ -1035,8 +1035,7 @@ config NSH_DRIPv6ADDR_1 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the first of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. config NSH_DRIPv6ADDR_2 hex "[1]" @@ -1046,8 +1045,7 @@ config NSH_DRIPv6ADDR_2 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the second of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. config NSH_DRIPv6ADDR_3 hex "[2]" @@ -1057,8 +1055,7 @@ config NSH_DRIPv6ADDR_3 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the third of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. config NSH_DRIPv6ADDR_4 hex "[3]" @@ -1068,8 +1065,7 @@ config NSH_DRIPv6ADDR_4 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the fourth of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. config NSH_DRIPv6ADDR_5 hex "[4]" @@ -1079,8 +1075,7 @@ config NSH_DRIPv6ADDR_5 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the fifth of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. config NSH_DRIPv6ADDR_6 hex "[5]" @@ -1090,8 +1085,7 @@ config NSH_DRIPv6ADDR_6 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the sixth of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. config NSH_DRIPv6ADDR_7 hex "[6]" @@ -1101,8 +1095,7 @@ config NSH_DRIPv6ADDR_7 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the seventh of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. config NSH_DRIPv6ADDR_8 hex "[7]" @@ -1112,8 +1105,7 @@ config NSH_DRIPv6ADDR_8 Default router IP address (aka, Gateway). This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the last of the - 8-values. The default for all eight values is - fc00:0000:0000:0000:0000:0000:0000:0001. + 8-values. The default for all eight values is fc00::1. comment "IPv6 Network mask" @@ -1125,7 +1117,7 @@ config NSH_IPv6NETMASK_1 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the first of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. config NSH_IPv6NETMASK_2 hex "[1]" @@ -1135,7 +1127,7 @@ config NSH_IPv6NETMASK_2 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the second of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. config NSH_IPv6NETMASK_3 hex "[2]" @@ -1145,7 +1137,7 @@ config NSH_IPv6NETMASK_3 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the third of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. config NSH_IPv6NETMASK_4 hex "[3]" @@ -1155,7 +1147,7 @@ config NSH_IPv6NETMASK_4 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the fourth of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. config NSH_IPv6NETMASK_5 hex "[4]" @@ -1165,7 +1157,7 @@ config NSH_IPv6NETMASK_5 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the fifth of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. config NSH_IPv6NETMASK_6 hex "[5]" @@ -1175,7 +1167,7 @@ config NSH_IPv6NETMASK_6 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the sixth of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. config NSH_IPv6NETMASK_7 hex "[6]" @@ -1185,7 +1177,7 @@ config NSH_IPv6NETMASK_7 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the seventh of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. config NSH_IPv6NETMASK_8 hex "[7]" @@ -1195,7 +1187,7 @@ config NSH_IPv6NETMASK_8 Network mask. This is a 16-bit integer value in host order. Each of the eight values forming the full IP address must be specified individually. This is the eighth of the 8-values. The default for - all eight values is fe00:0000:0000:0000:0000:0000:0000:0000. + all eight values is fe00::0. endif #NET_IPv6 endmenu # IP Address Configuration diff --git a/apps/nshlib/nsh_mntcmds.c b/apps/nshlib/nsh_mntcmds.c index 55d9df9b6..6857947c5 100644 --- a/apps/nshlib/nsh_mntcmds.c +++ b/apps/nshlib/nsh_mntcmds.c @@ -534,8 +534,8 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifdef CONFIG_NET_IPv6 sin = (FAR struct sockaddr_in6 *)&data.addr; - sin->sin_family = AF_INET6; - sin->sin_port = htons(NFS_PMAPPORT); + sin->sin6_family = AF_INET6; + sin->sin6_port = htons(NFS_PMAPPORT); memcpy(&sin->sin6_addr, &inaddr, sizeof(struct in6_addr)); data.addrlen = sizeof(struct sockaddr_in6); #else diff --git a/apps/nshlib/nsh_routecmds.c b/apps/nshlib/nsh_routecmds.c index 30489332a..3cf27050d 100644 --- a/apps/nshlib/nsh_routecmds.c +++ b/apps/nshlib/nsh_routecmds.c @@ -135,7 +135,7 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) memset(&target, 0, sizeof(target)); #ifdef CONFIG_NET_IPv6 - target.sin_family = AF_INET6; + target.sin6_family = AF_INET6; memcpy(&target.sin6_addr, &inaddr, sizeof(struct in6_addr)); #else target.sin_family = AF_INET; @@ -159,11 +159,11 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) memset(&netmask, 0, sizeof(netmask)); #ifdef CONFIG_NET_IPv6 - netmask.sin_family = AF_INET6; + netmask.sin6_family = AF_INET6; memcpy(&netmask.sin6_addr, &inaddr, sizeof(struct in6_addr)); #else - netmask.sin_family = AF_INET; - netmask.sin_addr = inaddr; + netmask.sin_family = AF_INET; + netmask.sin_addr = inaddr; #endif /* Convert the router IP address string into its binary form */ @@ -183,11 +183,11 @@ int cmd_addroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) memset(&router, 0, sizeof(router)); #ifdef CONFIG_NET_IPv6 - router.sin_family = AF_INET6; + router.sin6_family = AF_INET6; memcpy(&router.sin6_addr, &inaddr, sizeof(struct in6_addr)); #else - router.sin_family = AF_INET; - router.sin_addr = inaddr; + router.sin_family = AF_INET; + router.sin_addr = inaddr; #endif /* Then add the route */ @@ -263,11 +263,11 @@ int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) memset(&target, 0, sizeof(target)); #ifdef CONFIG_NET_IPv6 - target.sin_family = AF_INET6; + target.sin6_family = AF_INET6; memcpy(&target.sin6_addr, &inaddr, sizeof(struct in6_addr)); #else - target.sin_family = AF_INET; - target.sin_addr = inaddr; + target.sin_family = AF_INET; + target.sin_addr = inaddr; #endif /* Convert the netmask IP address string into its binary form */ @@ -287,11 +287,11 @@ int cmd_delroute(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) memset(&netmask, 0, sizeof(netmask)); #ifdef CONFIG_NET_IPv6 - netmask.sin_family = AF_INET6; + netmask.sin6_family = AF_INET6; memcpy(&netmask.sin6_addr, &inaddr, sizeof(struct in6_addr)); #else - netmask.sin_family = AF_INET; - netmask.sin_addr = inaddr; + netmask.sin_family = AF_INET; + netmask.sin_addr = inaddr; #endif /* Then delete the route */ diff --git a/nuttx/include/netinet/in.h b/nuttx/include/netinet/in.h index 8af93c8d6..9a5ae27b6 100644 --- a/nuttx/include/netinet/in.h +++ b/nuttx/include/netinet/in.h @@ -143,8 +143,8 @@ struct in6_addr struct sockaddr_in6 { - sa_family_t sin_family; /* Address family: AF_INET */ - uint16_t sin_port; /* Port in network byte order */ + sa_family_t sin6_family; /* Address family: AF_INET */ + uint16_t sin6_port; /* Port in network byte order */ struct in6_addr sin6_addr; /* IPv6 internet address */ }; diff --git a/nuttx/net/netdev/netdev_ioctl.c b/nuttx/net/netdev/netdev_ioctl.c index 26758b623..ab88799cc 100644 --- a/nuttx/net/netdev/netdev_ioctl.c +++ b/nuttx/net/netdev/netdev_ioctl.c @@ -147,8 +147,8 @@ static int ioctl_addipv6route(FAR struct rtentry *rtentry) net_ipv6addr_t netmask; net_ipv6addr_t router; - addr = (FAR struct sockaddr_in6 *)rtentry->rt_target; - target = (net_ipv6addr_t)addr->sin6_addr.u6_addr16; + addr = (FAR struct sockaddr_in6 *)rtentry->rt_target; + target = (net_ipv6addr_t)addr->sin6_addr.u6_addr16; addr = (FAR struct sockaddr_in6 *)rtentry->rt_netmask; netmask = (net_ipv6addr_t)addr->sin6_addr.u6_addr16; @@ -264,8 +264,8 @@ static void ioctl_getipv6addr(FAR struct sockaddr_storage *outaddr, FAR const net_ipv6addr_t inaddr) { FAR struct sockaddr_in6 *dest = (FAR struct sockaddr_in6 *)outaddr; - dest->sin_family = AF_INET6; - dest->sin_port = 0; + dest->sin6_family = AF_INET6; + dest->sin6_port = 0; memcpy(dest->sin6_addr.in6_u.u6_addr8, inaddr, 16); } #endif diff --git a/nuttx/net/socket/accept.c b/nuttx/net/socket/accept.c index 71a7812ea..f9ba0dc13 100644 --- a/nuttx/net/socket/accept.c +++ b/nuttx/net/socket/accept.c @@ -135,8 +135,8 @@ static inline void accept_tcpsender(FAR struct socket *psock, FAR struct sockaddr_in6 *inaddr = (FAR struct sockaddr_in6 *)addr; DEBUGASSERT(psock->s_domain == PF_INET6); - inaddr->sin_family = AF_INET6; - inaddr->sin_port = conn->rport; + inaddr->sin6_family = AF_INET6; + inaddr->sin6_port = conn->rport; net_ipv6addr_copy(inaddr->sin6_addr.s6_addr, conn->u.ipv6.raddr); } #endif /* CONFIG_NET_IPv6 */ diff --git a/nuttx/net/socket/getsockname.c b/nuttx/net/socket/getsockname.c index 423e1147b..9cadc9f9e 100644 --- a/nuttx/net/socket/getsockname.c +++ b/nuttx/net/socket/getsockname.c @@ -242,10 +242,10 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, case SOCK_STREAM: { FAR struct tcp_conn_s *tcp_conn = (FAR struct tcp_conn_s *)psock->s_conn; - outaddr->sin_port = tcp_conn->lport; /* Already in network byte order */ + outaddr->sin6_port = tcp_conn->lport; /* Already in network byte order */ #ifdef CONFIG_NETDEV_MULTINIC - lipaddr = &tcp_conn->u.ipv6.laddr; - ripaddr = &tcp_conn->u.ipv6.raddr; + lipaddr = &tcp_conn->u.ipv6.laddr; + ripaddr = &tcp_conn->u.ipv6.raddr; #endif } break; @@ -255,10 +255,10 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, case SOCK_DGRAM: { FAR struct udp_conn_s *udp_conn = (FAR struct udp_conn_s *)psock->s_conn; - outaddr->sin_port = udp_conn->lport; /* Already in network byte order */ + outaddr->sin6_port = udp_conn->lport; /* Already in network byte order */ #ifdef CONFIG_NETDEV_MULTINIC - lipaddr = &udp_conn->u.ipv6.laddr; - ripaddr = &udp_conn->u.ipv6.raddr; + lipaddr = &udp_conn->u.ipv6.laddr; + ripaddr = &udp_conn->u.ipv6.raddr; #endif } break; @@ -294,7 +294,7 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr, /* Set the address family and the IP address */ #if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_UDP) - outaddr->sin_family = AF_INET6; + outaddr->sin6_family = AF_INET6; memcpy(outaddr->sin6_addr.in6_u.u6_addr8, dev->d_ipv6addr, 16); *addrlen = sizeof(struct sockaddr_in6); #endif diff --git a/nuttx/net/socket/recvfrom.c b/nuttx/net/socket/recvfrom.c index f2b3a65eb..7fe248395 100644 --- a/nuttx/net/socket/recvfrom.c +++ b/nuttx/net/socket/recvfrom.c @@ -586,8 +586,8 @@ static inline void recvfrom_tcpsender(FAR struct net_driver_s *dev, FAR struct tcp_hdr_s *tcp = TCPIPv6BUF; FAR struct ipv6_hdr_s *ipv6 = IPv6BUF; - infrom->sin_family = AF_INET6; - infrom->sin_port = tcp->srcport; + infrom->sin6_family = AF_INET6; + infrom->sin6_port = tcp->srcport; net_ipv6addr_copy(infrom->sin6_addr.s6_addr, ipv6->srcipaddr); } @@ -861,8 +861,8 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_ FAR struct udp_hdr_s *udp = UDPIPv6BUF; FAR struct ipv6_hdr_s *ipv6 = IPv6BUF; - infrom->sin_family = AF_INET6; - infrom->sin_port = udp->srcport; + infrom->sin6_family = AF_INET6; + infrom->sin6_port = udp->srcport; net_ipv6addr_copy(infrom->sin6_addr.s6_addr, ipv6->srcipaddr); } diff --git a/nuttx/net/tcp/tcp_conn.c b/nuttx/net/tcp/tcp_conn.c index 4c531dfa1..32a5b7e25 100644 --- a/nuttx/net/tcp/tcp_conn.c +++ b/nuttx/net/tcp/tcp_conn.c @@ -577,9 +577,9 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn, #ifdef CONFIG_NETDEV_MULTINIC port = tcp_selectport(PF_INET6, (FAR const union ip_addr_u ipaddr *)addr->sin6_addr.in6_u.u6_addr16, - ntohs(addr->sin_port)); + ntohs(addr->sin6_port)); #else - port = tcp_selectport(ntohs(addr->sin_port)); + port = tcp_selectport(ntohs(addr->sin6_port)); #endif net_unlock(flags); @@ -591,7 +591,7 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn, /* Save the local address in the connection structure. */ - conn->lport = addr->sin_port; + conn->lport = addr->sin6_port; #ifdef CONFIG_NETDEV_MULTINIC net_ipv6addr_copy(conn->u.ipv6.laddr, addr->sin6_addr.in6_u.u6_addr16); @@ -1165,7 +1165,7 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr) /* Save MSS and the port from the sockaddr (already in network order) */ conn->mss = MIN_IPv6_TCP_INITIAL_MSS; - conn->rport = inaddr->sin_port; + conn->rport = inaddr->sin6_port; /* The sockaddr address is 32-bits in network order. */ diff --git a/nuttx/net/udp/udp_conn.c b/nuttx/net/udp/udp_conn.c index acce00d24..3f2106da0 100644 --- a/nuttx/net/udp/udp_conn.c +++ b/nuttx/net/udp/udp_conn.c @@ -604,7 +604,7 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr) /* Get the port number that we are binding to */ - portno = inaddr->sin_port; + portno = inaddr->sin6_port; #ifdef CONFIG_NETDEV_MULTINIC /* Bind the local IP address to the connection. NOTE this address may @@ -725,7 +725,7 @@ int udp_connect(FAR struct udp_conn_s *conn, FAR const struct sockaddr *addr) FAR const struct sockaddr_in6 *inaddr = (FAR const struct sockaddr_in6 *)addr; - conn->rport = inaddr->sin_port; + conn->rport = inaddr->sin6_port; net_ipv6addr_copy(conn->u.ipv6.raddr, inaddr->sin6_addr.s6_addr16); } #endif /* CONFIG_NET_IPv6 */ -- cgit v1.2.3