diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-01-16 12:30:18 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-01-16 12:30:18 -0600 |
commit | 80ea43c7c968cd7f9617ab8a69892b4214e6664c (patch) | |
tree | 0fd0ccd53493c12a7cd79a322e48680763715228 /nuttx/net/devif | |
parent | 9d7bd7674895cf2d6f21501396f6945a14231e7b (diff) | |
download | px4-nuttx-80ea43c7c968cd7f9617ab8a69892b4214e6664c.tar.gz px4-nuttx-80ea43c7c968cd7f9617ab8a69892b4214e6664c.tar.bz2 px4-nuttx-80ea43c7c968cd7f9617ab8a69892b4214e6664c.zip |
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.
Diffstat (limited to 'nuttx/net/devif')
-rw-r--r-- | nuttx/net/devif/devif.h | 11 | ||||
-rw-r--r-- | nuttx/net/devif/devif_initialize.c | 26 | ||||
-rw-r--r-- | nuttx/net/devif/ipv4_input.c | 5 | ||||
-rw-r--r-- | nuttx/net/devif/ipv6_input.c | 4 |
4 files changed, 26 insertions, 20 deletions
diff --git a/nuttx/net/devif/devif.h b/nuttx/net/devif/devif.h index ce303562d..58b43887e 100644 --- a/nuttx/net/devif/devif.h +++ b/nuttx/net/devif/devif.h @@ -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. */ diff --git a/nuttx/net/devif/devif_initialize.c b/nuttx/net/devif/devif_initialize.c index 5da9aa27f..30ee976df 100644 --- a/nuttx/net/devif/devif_initialize.c +++ b/nuttx/net/devif/devif_initialize.c @@ -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 diff --git a/nuttx/net/devif/ipv4_input.c b/nuttx/net/devif/ipv4_input.c index f10cfc68a..589e685ba 100644 --- a/nuttx/net/devif/ipv4_input.c +++ b/nuttx/net/devif/ipv4_input.c @@ -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 diff --git a/nuttx/net/devif/ipv6_input.c b/nuttx/net/devif/ipv6_input.c index 43a14a946..c9b3741b7 100644 --- a/nuttx/net/devif/ipv6_input.c +++ b/nuttx/net/devif/ipv6_input.c @@ -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 |