diff options
-rw-r--r-- | apps/netutils/smtp/smtp.c | 2 | ||||
-rw-r--r-- | nuttx/include/nuttx/net/ip.h | 73 | ||||
-rw-r--r-- | nuttx/net/igmp/igmp_group.c | 4 | ||||
-rw-r--r-- | nuttx/net/igmp/igmp_input.c | 4 | ||||
-rw-r--r-- | nuttx/net/igmp/igmp_send.c | 6 | ||||
-rw-r--r-- | nuttx/net/netdev/netdev_findbyaddr.c | 8 | ||||
-rw-r--r-- | nuttx/net/route/net_addroute.c | 6 | ||||
-rw-r--r-- | nuttx/net/route/net_delroute.c | 8 | ||||
-rw-r--r-- | nuttx/net/route/net_router.c | 12 | ||||
-rw-r--r-- | nuttx/net/route/netdev_router.c | 4 | ||||
-rw-r--r-- | nuttx/net/socket/accept.c | 16 | ||||
-rw-r--r-- | nuttx/net/socket/recvfrom.c | 12 | ||||
-rw-r--r-- | nuttx/net/tcp/tcp_conn.c | 14 | ||||
-rw-r--r-- | nuttx/net/tcp/tcp_send.c | 8 | ||||
-rw-r--r-- | nuttx/net/udp/udp_conn.c | 4 | ||||
-rw-r--r-- | nuttx/net/udp/udp_send.c | 8 |
16 files changed, 91 insertions, 98 deletions
diff --git a/apps/netutils/smtp/smtp.c b/apps/netutils/smtp/smtp.c index f33183ff6..d3cab20a9 100644 --- a/apps/netutils/smtp/smtp.c +++ b/apps/netutils/smtp/smtp.c @@ -290,7 +290,7 @@ void smtp_configure(FAR void *handle, FAR const char *lhostname, { FAR struct smtp_state *psmtp = (FAR struct smtp_state *)handle; psmtp->localhostname = lhostname; - net_ipaddr_copy(psmtp->smtpserver, paddr); + net_ipv4addr_copy(psmtp->smtpserver, paddr); } /* Send an e-mail. diff --git a/nuttx/include/nuttx/net/ip.h b/nuttx/include/nuttx/net/ip.h index ffce6af98..3f01a22a5 100644 --- a/nuttx/include/nuttx/net/ip.h +++ b/nuttx/include/nuttx/net/ip.h @@ -105,7 +105,7 @@ union ip_addr_u #endif #ifdef CONFIG_NET_IPv6 - /* IPv6 addresse */ + /* IPv6 address */ net_ipv6addr_t ipv6; #endif @@ -156,7 +156,7 @@ struct net_iphdr_s uint16_t srcipaddr[2]; /* 32-bit Source IP address */ uint16_t destipaddr[2]; /* 32-bit Destination IP address */ }; -#endif +#endif /* CONFIG_NET_IPv4 */ #ifdef CONFIG_NET_IPv6 /* The IPv6 header */ @@ -172,7 +172,7 @@ struct net_ipv6hdr_s net_ipv6addr_t srcipaddr; /* 128-bit Source address */ net_ipv6addr_t destipaddr; /* 128-bit Destination address */ }; -#endif +#endif /* CONFIG_NET_IPv6 */ /**************************************************************************** * Public Data @@ -258,26 +258,24 @@ struct net_ipv6hdr_s * src The source from where to copy. */ -#define net_ipv4addr_copy(dest, src) \ +#ifdef CONFIG_NET_IPv4 +# define net_ipv4addr_copy(dest, src) \ do { \ (dest) = (in_addr_t)(src); \ } while (0) -#define net_ipv4addr_hdrcopy(dest, src) \ +# define net_ipv4addr_hdrcopy(dest, src) \ do { \ ((uint16_t*)(dest))[0] = ((uint16_t*)(src))[0]; \ ((uint16_t*)(dest))[1] = ((uint16_t*)(src))[1]; \ } while (0) +#endif -#define net_ipv6addr_copy(dest, src) memcpy(&dest, &src, sizeof(net_ipv6addr_t)) -#define net_ipv6addr_hdrcopy(dest, src) net_ipv6addr_copy(dest, src) - -#ifndef CONFIG_NET_IPv6 -# define net_ipaddr_copy(dest, src) net_ipv4addr_copy(dest, src) -# define net_ipaddr_hdrcopy(dest, src) net_ipv4addr_hdrcopy(dest, src) -#else /* !CONFIG_NET_IPv6 */ -# define net_ipaddr_copy(dest, src) net_ipv6addr_copy(dest, src) -# define net_ipaddr_hdrcopy(dest, src) net_ipv6addr_hdrcopy(dest, src) -#endif /* !CONFIG_NET_IPv6 */ +#ifdef CONFIG_NET_IPv6 +# define net_ipv6addr_copy(dest,src) \ + memcpy(&dest, &src, sizeof(net_ipv6addr_t)) +# define net_ipv6addr_hdrcopy(dest,src) \ + net_ipv6addr_copy(dest, src) +#endif /* Compare two IP addresses * @@ -286,7 +284,7 @@ struct net_ipv6hdr_s * in_addr_t ipaddr1, ipaddr2; * * net_ipaddr(&ipaddr1, 192,16,1,2); - * if (net_ipaddr_cmp(ipaddr2, ipaddr1)) + * if (net_ipv4addr_cmp(ipaddr2, ipaddr1)) * { * printf("They are the same"); * } @@ -295,22 +293,18 @@ struct net_ipv6hdr_s * addr2 The second IP address. */ -#define net_ipv4addr_cmp(addr1, addr2) \ +#ifdef CONFIG_NET_IPv4 +# define net_ipv4addr_cmp(addr1, addr2) \ (addr1 == addr2) -#define net_ipv4addr_hdrcmp(addr1, addr2) \ - net_ipv4addr_cmp(net_ip4addr_conv32(addr1), net_ip4addr_conv32(addr2)) - -#define net_ipv6addr_cmp(addr1, addr2) \ - (memcmp(&addr1, &addr2, sizeof(net_ipv6addr_t)) == 0) -#define net_ipv6addr_hdrcmp(addr1, addr2) \ - net_ipv6addr_cmp(addr1, addr2) - -#if defined(CONFIG_NET_IPv4) -# define net_ipaddr_cmp(addr1, addr2) net_ipv4addr_cmp(addr1, addr2) -# define net_ipaddr_hdrcmp(addr1, addr2) net_ipv4addr_hdrcmp(addr1, addr2) -#elif defined(CONFIG_NET_IPv6) -# define net_ipaddr_cmp(addr1, addr2) net_ipv6addr_cmp(addr1, addr2) -# define net_ipaddr_hdrcmp(addr1, addr2) net_ipv6addr_hdrcmp(addr1, addr2) +# define net_ipv4addr_hdrcmp(addr1, addr2) \ + net_ipv4addr_cmp(net_ip4addr_conv32(addr1), net_ip4addr_conv32(addr2)) +#endif + +#ifdef CONFIG_NET_IPv4 +# define net_ipv6addr_cmp(addr1, addr2) \ + (memcmp(&addr1, &addr2, sizeof(net_ipv6addr_t)) == 0) +# define net_ipv6addr_hdrcmp(addr1, addr2) \ + net_ipv6addr_cmp(addr1, addr2) #endif /* Compare two IP addresses under a netmask. The mask is used to mask @@ -326,7 +320,7 @@ struct net_ipv6hdr_s * net_ipaddr(&mask, 255,255,255,0); * net_ipaddr(&ipaddr1, 192,16,1,2); * net_ipaddr(&ipaddr2, 192,16,1,3); - * if (net_ipaddr_maskcmp(ipaddr1, ipaddr2, &mask)) + * if (net_ipv4addr_maskcmp(ipaddr1, ipaddr2, &mask)) * { * printf("They are the same"); * } @@ -336,19 +330,16 @@ struct net_ipv6hdr_s * mask The netmask. */ -#define net_ipv4addr_maskcmp(addr1, addr2, mask) \ - (((in_addr_t)(addr1) & (in_addr_t)(mask)) == \ - ((in_addr_t)(addr2) & (in_addr_t)(mask))) - -#ifndef CONFIG_NET_IPv6 -# define net_ipaddr_maskcmp(a,b,m) net_ipv4addr_maskcmp(a,b,m) +#ifdef CONFIG_NET_IPv4 +# define net_ipv4addr_maskcmp(addr1, addr2, mask) \ + (((in_addr_t)(addr1) & (in_addr_t)(mask)) == \ + ((in_addr_t)(addr2) & (in_addr_t)(mask))) +#endif -#else +#ifdef CONFIG_NET_IPv6 bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1, const net_ipv6addr_t addr2, const net_ipv6addr_t mask); - -# define net_ipaddr_maskcmp(a,b,m) net_ipv6addr_maskcmp(a,b,m) #endif /* Mask out the network part of an IP address, given the address and diff --git a/nuttx/net/igmp/igmp_group.c b/nuttx/net/igmp/igmp_group.c index 613c0fddf..3f33207f9 100644 --- a/nuttx/net/igmp/igmp_group.c +++ b/nuttx/net/igmp/igmp_group.c @@ -251,7 +251,7 @@ FAR struct igmp_group_s *igmp_grpalloc(FAR struct net_driver_s *dev, { /* Initialize the non-zero elements of the group structure */ - net_ipaddr_copy(group->grpaddr, *addr); + net_ipv4addr_copy(group->grpaddr, *addr); sem_init(&group->sem, 0, 0); /* Initialize the group timer (but don't start it yet) */ @@ -301,7 +301,7 @@ FAR struct igmp_group_s *igmp_grpfind(FAR struct net_driver_s *dev, group = group->next) { grplldbg("Compare: %08x vs. %08x\n", group->grpaddr, *addr); - if (net_ipaddr_cmp(group->grpaddr, *addr)) + if (net_ipv4addr_cmp(group->grpaddr, *addr)) { grplldbg("Match!\n"); break; diff --git a/nuttx/net/igmp/igmp_input.c b/nuttx/net/igmp/igmp_input.c index 5024c472b..f2f7363d7 100644 --- a/nuttx/net/igmp/igmp_input.c +++ b/nuttx/net/igmp/igmp_input.c @@ -165,7 +165,7 @@ void igmp_input(struct net_driver_s *dev) /* Check if the query was sent to all systems */ - if (net_ipaddr_cmp(destipaddr, g_ipv4_allsystems)) + if (net_ipv4addr_cmp(destipaddr, g_ipv4_allsystems)) { /* Yes... Now check the if this this is a general or a group * specific query. @@ -206,7 +206,7 @@ void igmp_input(struct net_driver_s *dev) { /* Skip over the all systems group entry */ - if (!net_ipaddr_cmp(member->grpaddr, g_ipv4_allsystems)) + if (!net_ipv4addr_cmp(member->grpaddr, g_ipv4_allsystems)) { ticks = net_dsec2tick((int)IGMPBUF->maxresp); if (IS_IDLEMEMBER(member->flags) || diff --git a/nuttx/net/igmp/igmp_send.c b/nuttx/net/igmp/igmp_send.c index c19c690c2..4ec191b5d 100644 --- a/nuttx/net/igmp/igmp_send.c +++ b/nuttx/net/igmp/igmp_send.c @@ -155,8 +155,8 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group, IGMPBUF->ttl = IGMP_TTL; IGMPBUF->proto = IP_PROTO_IGMP; - net_ipaddr_hdrcopy(IGMPBUF->srcipaddr, &dev->d_ipaddr); - net_ipaddr_hdrcopy(IGMPBUF->destipaddr, destipaddr); + net_ipv4addr_hdrcopy(IGMPBUF->srcipaddr, &dev->d_ipaddr); + net_ipv4addr_hdrcopy(IGMPBUF->destipaddr, destipaddr); /* Calculate IP checksum. */ @@ -167,7 +167,7 @@ void igmp_send(FAR struct net_driver_s *dev, FAR struct igmp_group_s *group, IGMPBUF->type = group->msgid; IGMPBUF->maxresp = 0; - net_ipaddr_hdrcopy(IGMPBUF->grpaddr, &group->grpaddr); + net_ipv4addr_hdrcopy(IGMPBUF->grpaddr, &group->grpaddr); /* Calculate the IGMP checksum. */ diff --git a/nuttx/net/netdev/netdev_findbyaddr.c b/nuttx/net/netdev/netdev_findbyaddr.c index f9a61d724..d1dc0ce3c 100644 --- a/nuttx/net/netdev/netdev_findbyaddr.c +++ b/nuttx/net/netdev/netdev_findbyaddr.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/netdev/netdev_findbyaddr.c * - * Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -107,7 +107,8 @@ static FAR struct net_driver_s *netdev_finddevice_ipv4addr(in_addr_t ripaddr) { /* Yes.. check for an address match (under the netmask) */ - if (net_ipaddr_maskcmp(dev->d_ipaddr, ripaddr, dev->d_netmask)) + if (net_ipv4addr_maskcmp(dev->d_ipaddr, ripaddr, + dev->d_netmask)) { /* Its a match */ @@ -160,7 +161,8 @@ netdev_finddevice_ipv6addr(const net_ipv6addr_t ripaddr) { /* Yes.. check for an address match (under the netmask) */ - if (net_ipaddr_maskcmp(dev->d_ipv6addr, ripaddr, dev->d_ipv6netmask)) + if (net_ipv6addr_maskcmp(dev->d_ipv6addr, ripaddr, + dev->d_ipv6netmask)) { /* Its a match */ diff --git a/nuttx/net/route/net_addroute.c b/nuttx/net/route/net_addroute.c index 8af1cf182..d2edc2646 100644 --- a/nuttx/net/route/net_addroute.c +++ b/nuttx/net/route/net_addroute.c @@ -94,9 +94,9 @@ int net_addroute(in_addr_t target, in_addr_t netmask, in_addr_t router) /* Format the new route table entry */ - net_ipaddr_copy(route->target, target); - net_ipaddr_copy(route->netmask, netmask); - net_ipaddr_copy(route->router, router); + net_ipv4addr_copy(route->target, target); + net_ipv4addr_copy(route->netmask, netmask); + net_ipv4addr_copy(route->router, router); /* Get exclusive address to the networking data structures */ diff --git a/nuttx/net/route/net_delroute.c b/nuttx/net/route/net_delroute.c index 6ebd3d6c0..5e7f019ef 100644 --- a/nuttx/net/route/net_delroute.c +++ b/nuttx/net/route/net_delroute.c @@ -87,8 +87,8 @@ static int net_match(FAR struct net_route_s *route, FAR void *arg) * must be the same. */ - if (net_ipaddr_maskcmp(route->target, match->target, match->netmask) && - net_ipaddr_cmp(route->netmask, match->netmask)) + if (net_ipv4addr_maskcmp(route->target, match->target, match->netmask) && + net_ipv4addr_cmp(route->netmask, match->netmask)) { /* They match.. Remove the entry from the routing table */ @@ -141,8 +141,8 @@ int net_delroute(in_addr_t target, in_addr_t netmask) /* Set up the comparison structure */ match.prev = NULL; - net_ipaddr_copy(match.target, target); - net_ipaddr_copy(match.netmask, netmask); + net_ipv4addr_copy(match.target, target); + net_ipv4addr_copy(match.netmask, netmask); /* Then remove the entry from the routing table */ diff --git a/nuttx/net/route/net_router.c b/nuttx/net/route/net_router.c index 993cc08bd..0c585647d 100644 --- a/nuttx/net/route/net_router.c +++ b/nuttx/net/route/net_router.c @@ -103,7 +103,7 @@ static int net_ipv4_match(FAR struct net_route_s *route, FAR void *arg) { /* They match.. Copy the router address */ - net_ipaddr_copy(match->router, route->router); + net_ipv4addr_copy(match->router, route->router); return 1; } @@ -143,7 +143,7 @@ static int net_ipv6_match(FAR struct net_route_s *route, FAR void *arg) { /* They match.. Copy the router address */ - net_ipaddr_copy(match->router, route->router); + net_ipv6addr_copy(match->router, route->router); return 1; } #endif @@ -181,7 +181,7 @@ int net_ipv4_router(in_addr_t target, FAR in_addr_t *router) /* Do not route the special broadcast IP address */ - if (net_ipaddr_cmp(target, g_ipv4_alloneaddr)) + if (net_ipv4addr_cmp(target, g_ipv4_alloneaddr)) { return -ENOENT; } @@ -189,7 +189,7 @@ int net_ipv4_router(in_addr_t target, FAR in_addr_t *router) /* Set up the comparison structure */ memset(&match, 0, sizeof(struct route_ipv4_match_s)); - net_ipaddr_copy(match.target, target); + net_ipv4addr_copy(match.target, target); /* Find an router entry with the routing table that can forward to this * address @@ -239,7 +239,7 @@ int net_ipv6_router(net_ipv6addr_t target, net_ipv6addr_t router) /* Do not route the special broadcast IP address */ - if (net_ipaddr_cmp(target, g_ipv6_alloneaddr)) + if (net_ipv6addr_cmp(target, g_ipv6_alloneaddr)) { return -ENOENT; } @@ -247,7 +247,7 @@ int net_ipv6_router(net_ipv6addr_t target, net_ipv6addr_t router) /* Set up the comparison structure */ memset(&match, 0, sizeof(struct route_ipv6_match_s)); - net_ipaddr_copy(match.target, target); + net_ipv6addr_copy(match.target, target); /* Find an router entry with the routing table that can forward to this * address diff --git a/nuttx/net/route/netdev_router.c b/nuttx/net/route/netdev_router.c index 65a65cab0..b7f879f07 100644 --- a/nuttx/net/route/netdev_router.c +++ b/nuttx/net/route/netdev_router.c @@ -190,7 +190,7 @@ void netdev_ipv4_router(FAR struct net_driver_s *dev, in_addr_t target, memset(&match, 0, sizeof(struct route_ipv4_devmatch_s)); match.dev = dev; - net_ipaddr_copy(match.target, target); + net_ipv4addr_copy(match.target, target); /* Find an router entry with the routing table that can forward to this * address using this device. @@ -247,7 +247,7 @@ void netdev_ipv6_router(FAR struct net_driver_s *dev, memset(&match, 0, sizeof(struct route_ipv6_devmatch_s)); match.dev = dev; - net_ipaddr_copy(match.target, target); + net_ipv6addr_copy(match.target, target); /* Find an router entry with the routing table that can forward to this * address using this device. diff --git a/nuttx/net/socket/accept.c b/nuttx/net/socket/accept.c index ddc5b23ed..91e8197ed 100644 --- a/nuttx/net/socket/accept.c +++ b/nuttx/net/socket/accept.c @@ -104,29 +104,29 @@ struct accept_s ****************************************************************************/ #ifdef CONFIG_NET_TCP -#ifdef CONFIG_NET_IPv6 +#ifdef CONFIG_NET_IPv4 static inline void accept_tcpsender(FAR struct tcp_conn_s *conn, - FAR struct sockaddr_in6 *addr) + FAR struct sockaddr_in *addr) { if (addr) { - addr->sin_family = AF_INET6; + addr->sin_family = AF_INET; addr->sin_port = conn->rport; - net_ipaddr_copy(addr->sin6_addr.s6_addr, conn->u.ipv4.raddr); + net_ipv4addr_copy(addr->sin_addr.s_addr, conn->u.ipv4.raddr); } } #else static inline void accept_tcpsender(FAR struct tcp_conn_s *conn, - FAR struct sockaddr_in *addr) + FAR struct sockaddr_in6 *addr) { if (addr) { - addr->sin_family = AF_INET; + addr->sin_family = AF_INET6; addr->sin_port = conn->rport; - net_ipaddr_copy(addr->sin_addr.s_addr, conn->u.ipv4.raddr); + net_ipv6addr_copy(addr->sin6_addr.s6_addr, conn->u.ipv4.raddr); } } -#endif /* CONFIG_NET_IPv6 */ +#endif /* CONFIG_NET_IPv4 */ #endif /* CONFIG_NET_TCP */ /**************************************************************************** diff --git a/nuttx/net/socket/recvfrom.c b/nuttx/net/socket/recvfrom.c index 0079ca85c..af633fbb2 100644 --- a/nuttx/net/socket/recvfrom.c +++ b/nuttx/net/socket/recvfrom.c @@ -584,10 +584,10 @@ static inline void recvfrom_tcpsender(FAR struct net_driver_s *dev, infrom->sin_port = TCPBUF->srcport; #ifdef CONFIG_NET_IPv6 - net_ipaddr_copy(infrom->sin6_addr.s6_addr, TCPBUF->srcipaddr); + net_ipv6addr_copy(infrom->sin6_addr.s6_addr, TCPBUF->srcipaddr); #else - net_ipaddr_copy(infrom->sin_addr.s_addr, - net_ip4addr_conv32(TCPBUF->srcipaddr)); + net_ipv4addr_copy(infrom->sin_addr.s_addr, + net_ip4addr_conv32(TCPBUF->srcipaddr)); #endif } } @@ -831,10 +831,10 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_ infrom->sin_port = UDPBUF->srcport; #ifdef CONFIG_NET_IPv6 - net_ipaddr_copy(infrom->sin6_addr.s6_addr, UDPBUF->srcipaddr); + net_ipv6addr_copy(infrom->sin6_addr.s6_addr, UDPBUF->srcipaddr); #else - net_ipaddr_copy(infrom->sin_addr.s_addr, - net_ip4addr_conv32(UDPBUF->srcipaddr)); + net_ipv4addr_copy(infrom->sin_addr.s_addr, + net_ip4addr_conv32(UDPBUF->srcipaddr)); #endif } } diff --git a/nuttx/net/tcp/tcp_conn.c b/nuttx/net/tcp/tcp_conn.c index f23694c5e..f2cc71914 100644 --- a/nuttx/net/tcp/tcp_conn.c +++ b/nuttx/net/tcp/tcp_conn.c @@ -524,10 +524,10 @@ FAR struct tcp_conn_s *tcp_active(FAR struct net_driver_s *dev, tcp->destport == conn->lport && tcp->srcport == conn->rport && #ifdef CONFIG_NETDEV_MULTINIC - (net_ipaddr_cmp(conn->u.ipv4.laddr, g_ipv4_allzeroaddr) || - net_ipaddr_cmp(destipaddr, conn->u.ipv4.laddr)) && + (net_ipv4addr_cmp(conn->u.ipv4.laddr, g_ipv4_allzeroaddr) || + net_ipv4addr_cmp(destipaddr, conn->u.ipv4.laddr)) && #endif - net_ipaddr_cmp(srcipaddr, conn->u.ipv4.raddr)) + net_ipv4addr_cmp(srcipaddr, conn->u.ipv4.raddr)) { /* Matching connection found.. break out of the loop and return a * reference to it. @@ -600,9 +600,9 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev, conn->lport = tcp->destport; conn->rport = tcp->srcport; conn->mss = TCP_INITIAL_MSS(dev); - net_ipaddr_copy(conn->u.ipv4.raddr, net_ip4addr_conv32(ip->srcipaddr)); + net_ipv4addr_copy(conn->u.ipv4.raddr, net_ip4addr_conv32(ip->srcipaddr)); #ifdef CONFIG_NETDEV_MULTINIC - net_ipaddr_copy(conn->u.ipv4.laddr, net_ip4addr_conv32(ip->destipaddr)); + net_ipv4addr_copy(conn->u.ipv4.laddr, net_ip4addr_conv32(ip->destipaddr)); #endif conn->tcpstateflags = TCP_SYN_RCVD; @@ -706,7 +706,7 @@ int tcp_bind(FAR struct tcp_conn_s *conn, conn->lport = addr->sin_port; #ifdef CONFIG_NETDEV_MULTINIC - net_ipaddr_copy(conn->u.ipv4.laddr, ipaddr); + net_ipv4addr_copy(conn->u.ipv4.laddr, ipaddr); #endif return OK; @@ -800,7 +800,7 @@ int tcp_connect(FAR struct tcp_conn_s *conn, /* The sockaddr address is 32-bits in network order. */ - net_ipaddr_copy(conn->u.ipv4.raddr, addr->sin_addr.s_addr); + net_ipv4addr_copy(conn->u.ipv4.raddr, addr->sin_addr.s_addr); #ifdef CONFIG_NET_TCP_READAHEAD /* Initialize the list of TCP read-ahead buffers */ diff --git a/nuttx/net/tcp/tcp_send.c b/nuttx/net/tcp/tcp_send.c index 7fbb0e045..1a70b6ab6 100644 --- a/nuttx/net/tcp/tcp_send.c +++ b/nuttx/net/tcp/tcp_send.c @@ -187,8 +187,8 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev, pbuf->srcport = conn->lport; pbuf->destport = conn->rport; - net_ipaddr_hdrcopy(pbuf->srcipaddr, &dev->d_ipaddr); - net_ipaddr_hdrcopy(pbuf->destipaddr, &conn->u.ipv4.raddr); + net_ipv4addr_hdrcopy(pbuf->srcipaddr, &dev->d_ipaddr); + net_ipv4addr_hdrcopy(pbuf->destipaddr, &conn->u.ipv4.raddr); if (conn->tcpstateflags & TCP_STOPPED) { @@ -320,8 +320,8 @@ void tcp_reset(FAR struct net_driver_s *dev) /* Swap IP addresses. */ - net_ipaddr_hdrcopy(pbuf->destipaddr, pbuf->srcipaddr); - net_ipaddr_hdrcopy(pbuf->srcipaddr, &dev->d_ipaddr); + net_ipv4addr_hdrcopy(pbuf->destipaddr, pbuf->srcipaddr); + net_ipv4addr_hdrcopy(pbuf->srcipaddr, &dev->d_ipaddr); /* And send out the RST packet */ diff --git a/nuttx/net/udp/udp_conn.c b/nuttx/net/udp/udp_conn.c index 33c779aeb..c1b3e5ecb 100644 --- a/nuttx/net/udp/udp_conn.c +++ b/nuttx/net/udp/udp_conn.c @@ -466,7 +466,7 @@ int udp_bind(FAR struct udp_conn_s *conn, FAR const struct sockaddr_in *addr) * for receiving (Sending will use the default port). */ - net_ipaddr_copy(conn->u.ipv4.laddr, ipaddr); + net_ipv4addr_copy(conn->u.ipv4.laddr, ipaddr); #endif /* Is the user requesting to bind to any port? */ @@ -563,7 +563,7 @@ int udp_connect(FAR struct udp_conn_s *conn, if (addr) { conn->rport = addr->sin_port; - net_ipaddr_copy(conn->u.ipv4.raddr, addr->sin_addr.s_addr); + net_ipv4addr_copy(conn->u.ipv4.raddr, addr->sin_addr.s_addr); } else { diff --git a/nuttx/net/udp/udp_send.c b/nuttx/net/udp/udp_send.c index 4455813f0..8ceff0710 100644 --- a/nuttx/net/udp/udp_send.c +++ b/nuttx/net/udp/udp_send.c @@ -125,8 +125,8 @@ void udp_send(struct net_driver_s *dev, struct udp_conn_s *conn) pudpbuf->proto = IP_PROTO_UDP; pudpbuf->ttl = conn->ttl; - net_ipaddr_copy(pudpbuf->srcipaddr, &dev->d_ipaddr); - net_ipaddr_copy(pudpbuf->destipaddr, &conn->u.ipv4.raddr); + net_ipv6addr_copy(pudpbuf->srcipaddr, &dev->d_ipaddr); + net_ipav6ddr_copy(pudpbuf->destipaddr, &conn->u.ipv4.raddr); #else /* CONFIG_NET_IPv6 */ @@ -142,8 +142,8 @@ void udp_send(struct net_driver_s *dev, struct udp_conn_s *conn) pudpbuf->ttl = conn->ttl; pudpbuf->proto = IP_PROTO_UDP; - net_ipaddr_hdrcopy(pudpbuf->srcipaddr, &dev->d_ipaddr); - net_ipaddr_hdrcopy(pudpbuf->destipaddr, &conn->u.ipv4.raddr); + net_ipv4addr_hdrcopy(pudpbuf->srcipaddr, &dev->d_ipaddr); + net_ipv4addr_hdrcopy(pudpbuf->destipaddr, &conn->u.ipv4.raddr); /* Calculate IP checksum. */ |