mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Networking: Replace all references to the macros net_ipaddr_copy, net_ipaddr_hdrcopy, net_ipaddr_cmp, net_ipaddr_hdrcmp, and net_ipaddr_maskcmp with the appropriate IPv4 or IPv6 version of the macro (such as net_ipv4addr_copy). The goal is to support both IPv4 and IPv6 simultaneously. This requires that the macros be distinct and not conditionally defined to one on or the other.
This commit is contained in:
+14
-14
@@ -104,18 +104,7 @@ struct accept_s
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_TCP
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
static inline void accept_tcpsender(FAR struct tcp_conn_s *conn,
|
||||
FAR struct sockaddr_in6 *addr)
|
||||
{
|
||||
if (addr)
|
||||
{
|
||||
addr->sin_family = AF_INET6;
|
||||
addr->sin_port = conn->rport;
|
||||
net_ipaddr_copy(addr->sin6_addr.s6_addr, conn->u.ipv4.raddr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_NET_IPv4
|
||||
static inline void accept_tcpsender(FAR struct tcp_conn_s *conn,
|
||||
FAR struct sockaddr_in *addr)
|
||||
{
|
||||
@@ -123,10 +112,21 @@ static inline void accept_tcpsender(FAR struct tcp_conn_s *conn,
|
||||
{
|
||||
addr->sin_family = AF_INET;
|
||||
addr->sin_port = conn->rport;
|
||||
net_ipaddr_copy(addr->sin_addr.s_addr, conn->u.ipv4.raddr);
|
||||
net_ipv4addr_copy(addr->sin_addr.s_addr, conn->u.ipv4.raddr);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
#else
|
||||
static inline void accept_tcpsender(FAR struct tcp_conn_s *conn,
|
||||
FAR struct sockaddr_in6 *addr)
|
||||
{
|
||||
if (addr)
|
||||
{
|
||||
addr->sin_family = AF_INET6;
|
||||
addr->sin_port = conn->rport;
|
||||
net_ipv6addr_copy(addr->sin6_addr.s6_addr, conn->u.ipv4.raddr);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv4 */
|
||||
#endif /* CONFIG_NET_TCP */
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user