Networking: Replace all references to net_ipaddr_t with either in_addr_t on net_ipv6addr_t. The goal is to support both IPv4 and IPv6 simultaneously. This requires that the two types be distinct and not conditionally typedef'ed to net_ipaddr_t.

This commit is contained in:
Gregory Nutt
2015-01-16 12:30:18 -06:00
parent 75ce2c895e
commit 5e938941a6
38 changed files with 795 additions and 325 deletions
+9 -2
View File
@@ -165,8 +165,15 @@ struct devif_callback_s
* Public Data
****************************************************************************/
extern const net_ipaddr_t g_alloneaddr;
extern const net_ipaddr_t g_allzeroaddr;
#ifdef CONFIG_NET_IPv4
extern const in_addr_t g_ipv4_alloneaddr;
extern const in_addr_t g_ipv4_allzeroaddr;
#endif
#ifdef CONFIG_NET_IPv6
extern const net_ipv6addr_t g_ipv6_alloneaddr;
extern const net_ipv6addr_t g_ipv6_allzeroaddr;
#endif
/* Increasing number used for the IP ID field. */
+12 -14
View File
@@ -69,25 +69,23 @@ struct net_stats_s g_netstats;
uint16_t g_ipid;
const net_ipaddr_t g_alloneaddr =
#ifdef CONFIG_NET_IPv6
{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
#else
0xffffffff;
#endif
const net_ipaddr_t g_allzeroaddr =
#ifdef CONFIG_NET_IPv6
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};
#else
0x00000000;
#endif
#ifdef CONFIG_NET_IPv4
const in_addr_t g_ipv4_alloneaddr = 0xffffffff;
const in_addr_t g_ipv4_allzeroaddr = 0x00000000;
/* Reassembly timer (units: deci-seconds) */
#if defined(CONFIG_NET_TCP_REASSEMBLY) && !defined(CONFIG_NET_IPv6)
#ifdef CONFIG_NET_TCP_REASSEMBLY
uint8_t g_reassembly_timer;
#endif
#endif /* CONFIG_NET_IPv4 */
#ifdef CONFIG_NET_IPv6
const net_ipv6addr_t g_ipv6_alloneaddr =
{0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
const net_ipv6addr_t g_ipv6_allzeroaddr =
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};
#endif /* CONFIG_NET_IPv4 */
/****************************************************************************
* Private Variables
+3 -2
View File
@@ -381,7 +381,8 @@ int ipv4_input(FAR struct net_driver_s *dev)
#if defined(CONFIG_NET_BROADCAST) && defined(CONFIG_NET_UDP)
if (pbuf->proto == IP_PROTO_UDP &&
net_ipv4addr_cmp(net_ip4addr_conv32(pbuf->destipaddr), g_alloneaddr))
net_ipv4addr_cmp(net_ip4addr_conv32(pbuf->destipaddr),
g_ipv4_alloneaddr))
{
return udp_ipv4_input(dev);
}
@@ -394,7 +395,7 @@ int ipv4_input(FAR struct net_driver_s *dev)
else
#endif
#ifdef CONFIG_NET_ICMP
if (net_ipv4addr_cmp(dev->d_ipaddr, g_allzeroaddr))
if (net_ipv4addr_cmp(dev->d_ipaddr, g_ipv4_allzeroaddr))
{
/* If we are configured to use ping IP address configuration and
* hasn't been assigned an IP address yet, we accept all ICMP
+2 -2
View File
@@ -196,7 +196,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
#if defined(CONFIG_NET_BROADCAST) && defined(CONFIG_NET_UDP)
if (pbuf->proto == IP_PROTO_UDP &&
net_ipv6addr_cmp(pbuf->destipaddr, g_alloneaddr))
net_ipv6addr_cmp(pbuf->destipaddr, g_ipv6_alloneaddr))
{
return udp_ipv6_input(dev);
}
@@ -209,7 +209,7 @@ int ipv6_input(FAR struct net_driver_s *dev)
else
#endif
#ifdef CONFIG_NET_ICMPv6
if (net_ipv6addr_cmp(dev->d_ipv6addr, g_allzeroaddr))
if (net_ipv6addr_cmp(dev->d_ipv6addr, g_ipv6_allzeroaddr))
{
/* If we are configured to use ping IP address configuration and
* hasn't been assigned an IP address yet, we accept all ICMP