ICMPv6: This completes coding of the ICMPv6 auto-configuration feature. It is not yet functional

This commit is contained in:
Gregory Nutt 2015-02-03 15:40:56 -06:00
parent 0ee67383d5
commit 6273eb0160
6 changed files with 35 additions and 29 deletions

View File

@ -76,6 +76,7 @@ config EXAMPLES_NETTEST_CLIENTIP
endif # EXAMPLES_NETTEST_IPv4 endif # EXAMPLES_NETTEST_IPv4
if EXAMPLES_NETTEST_IPv6 if EXAMPLES_NETTEST_IPv6
if !NET_ICMPv6_AUTOCONF
comment "Target IPv6 address" comment "Target IPv6 address"
@ -323,6 +324,8 @@ config EXAMPLES_NETTEST_IPv6NETMASK_8
individually. This is the eighth of the 8-values. The default for individually. This is the eighth of the 8-values. The default for
all eight values is fe00::0. all eight values is fe00::0.
#endif /* NET_ICMPv6_AUTOCONF */
comment "Client IPv6 address" comment "Client IPv6 address"
config EXAMPLES_NETTEST_CLIENTIPv6ADDR_1 config EXAMPLES_NETTEST_CLIENTIPv6ADDR_1

View File

@ -60,8 +60,7 @@
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_NETTEST_IPv6 #if defined(CONFIG_EXAMPLES_NETTEST_IPv6) && !defined(CONFIG_NET_ICMPv6_AUTOCONF)
#ifndef CONFIG_NET_ICMPv6_AUTOCONF
/* Our host IPv6 address */ /* Our host IPv6 address */
static const uint16_t g_ipv6_hostaddr[8] = static const uint16_t g_ipv6_hostaddr[8] =
@ -75,7 +74,6 @@ static const uint16_t g_ipv6_hostaddr[8] =
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6ADDR_7), HTONS(CONFIG_EXAMPLES_NETTEST_IPv6ADDR_7),
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6ADDR_8), HTONS(CONFIG_EXAMPLES_NETTEST_IPv6ADDR_8),
}; };
#endif
/* Default routine IPv6 address */ /* Default routine IPv6 address */
@ -104,7 +102,7 @@ static const uint16_t g_ipv6_netmask[8] =
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_7), HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_7),
HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_8), HTONS(CONFIG_EXAMPLES_NETTEST_IPv6NETMASK_8),
}; };
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 */ #endif /* CONFIG_EXAMPLES_NETTEST_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF */
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -145,12 +143,12 @@ int nettest_main(int argc, char *argv[])
netlib_icmpv6_autoconfiguration("eth0"); netlib_icmpv6_autoconfiguration("eth0");
#else #else /* CONFIG_NET_ICMPv6_AUTOCONF */
/* Set up our fixed host address */ /* Set up our fixed host address */
netlib_set_ipv6addr("eth0", netlib_set_ipv6addr("eth0",
(FAR const struct in6_addr *)g_ipv6_hostaddr); (FAR const struct in6_addr *)g_ipv6_hostaddr);
#endif
/* Set up the default router address */ /* Set up the default router address */
@ -161,7 +159,10 @@ int nettest_main(int argc, char *argv[])
netlib_set_ipv6netmask("eth0", netlib_set_ipv6netmask("eth0",
(FAR const struct in6_addr *)g_ipv6_netmask); (FAR const struct in6_addr *)g_ipv6_netmask);
#else
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#else /* CONFIG_EXAMPLES_NETTEST_IPv6 */
/* Set up our host address */ /* Set up our host address */
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_IPADDR); addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_IPADDR);
@ -176,7 +177,8 @@ int nettest_main(int argc, char *argv[])
addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_NETMASK); addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_NETMASK);
netlib_set_ipv4netmask("eth0", &addr); netlib_set_ipv4netmask("eth0", &addr);
#endif
#endif /* CONFIG_EXAMPLES_NETTEST_IPv6 */
#ifdef CONFIG_EXAMPLES_NETTEST_SERVER #ifdef CONFIG_EXAMPLES_NETTEST_SERVER
recv_server(); recv_server();

View File

@ -56,6 +56,7 @@ config EXAMPLES_UDP_SERVERIP
endif # EXAMPLES_UDP_IPv4 endif # EXAMPLES_UDP_IPv4
if EXAMPLES_UDP_IPv6 if EXAMPLES_UDP_IPv6
if !NET_ICMPv6_AUTOCONF
comment "Target IPv6 address" comment "Target IPv6 address"
@ -303,7 +304,9 @@ config EXAMPLES_UDP_IPv6NETMASK_8
individually. This is the eighth of the 8-values. The default for individually. This is the eighth of the 8-values. The default for
all eight values is fe00::0. all eight values is fe00::0.
comment "Client IPv6 address" #endif /* NET_ICMPv6_AUTOCONF */
comment "Server IPv6 address"
config EXAMPLES_UDP_SERVERIPv6ADDR_1 config EXAMPLES_UDP_SERVERIPv6ADDR_1
hex "[0]" hex "[0]"

View File

@ -57,8 +57,7 @@
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_EXAMPLES_UDP_IPv6 #if defined(CONFIG_EXAMPLES_UDP_IPv6) && !defined(CONFIG_NET_ICMPv6_AUTOCONF)
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
/* Our host IPv6 address */ /* Our host IPv6 address */
static const uint16_t g_ipv6_hostaddr[8] = static const uint16_t g_ipv6_hostaddr[8] =
@ -72,7 +71,6 @@ static const uint16_t g_ipv6_hostaddr[8] =
HTONS(CONFIG_EXAMPLES_UDP_IPv6ADDR_7), HTONS(CONFIG_EXAMPLES_UDP_IPv6ADDR_7),
HTONS(CONFIG_EXAMPLES_UDP_IPv6ADDR_8), HTONS(CONFIG_EXAMPLES_UDP_IPv6ADDR_8),
}; };
#endif
/* Default routine IPv6 address */ /* Default routine IPv6 address */
@ -101,7 +99,7 @@ static const uint16_t g_ipv6_netmask[8] =
HTONS(CONFIG_EXAMPLES_UDP_IPv6NETMASK_7), HTONS(CONFIG_EXAMPLES_UDP_IPv6NETMASK_7),
HTONS(CONFIG_EXAMPLES_UDP_IPv6NETMASK_8), HTONS(CONFIG_EXAMPLES_UDP_IPv6NETMASK_8),
}; };
#endif /* CONFIG_EXAMPLES_UDP_IPv6 */ #endif /* CONFIG_EXAMPLES_UDP_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF */
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
@ -123,12 +121,12 @@ int udp_main(int argc, char *argv[])
netlib_icmpv6_autoconfiguration("eth0"); netlib_icmpv6_autoconfiguration("eth0");
#else #else /* CONFIG_NET_ICMPv6_AUTOCONF */
/* Set up our fixed host address */ /* Set up our fixed host address */
netlib_set_ipv6addr("eth0", netlib_set_ipv6addr("eth0",
(FAR const struct in6_addr *)g_ipv6_hostaddr); (FAR const struct in6_addr *)g_ipv6_hostaddr);
#endif
/* Set up the default router address */ /* Set up the default router address */
@ -139,7 +137,10 @@ int udp_main(int argc, char *argv[])
netlib_set_ipv6netmask("eth0", netlib_set_ipv6netmask("eth0",
(FAR const struct in6_addr *)g_ipv6_netmask); (FAR const struct in6_addr *)g_ipv6_netmask);
#else
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#else /* CONFIG_EXAMPLES_UDP_IPv6 */
struct in_addr addr; struct in_addr addr;
/* Set up our host address */ /* Set up our host address */
@ -156,7 +157,8 @@ int udp_main(int argc, char *argv[])
addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_NETMASK); addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_NETMASK);
netlib_set_ipv4netmask("eth0", &addr); netlib_set_ipv4netmask("eth0", &addr);
#endif
#endif /* CONFIG_EXAMPLES_UDP_IPv6 */
#ifdef CONFIG_EXAMPLES_UDP_SERVER #ifdef CONFIG_EXAMPLES_UDP_SERVER
recv_server(); recv_server();

View File

@ -930,8 +930,7 @@ config NSH_NETMASK
endif # NET_IPv4 endif # NET_IPv4
if NET_IPv6 if NET_IPv6 && !NET_ICMPv6_AUTOCONF
if !NET_ICMPv6_AUTOCONF
comment "Target IPv6 address" comment "Target IPv6 address"
@ -1023,8 +1022,6 @@ config NSH_IPv6ADDR_8
individually. This is the last of the 8-values. The default for individually. This is the last of the 8-values. The default for
all eight values is fc00::2. all eight values is fc00::2.
endif # !NET_ICMPv6_AUTOCONF
comment "Router IPv6 address" comment "Router IPv6 address"
config NSH_DRIPv6ADDR_1 config NSH_DRIPv6ADDR_1
@ -1189,7 +1186,7 @@ config NSH_IPv6NETMASK_8
individually. This is the eighth of the 8-values. The default for individually. This is the eighth of the 8-values. The default for
all eight values is fe00::0. all eight values is fe00::0.
endif #NET_IPv6 endif #NET_IPv6 && !NET_ICMPv6_AUTOCONF
endmenu # IP Address Configuration endmenu # IP Address Configuration
config NSH_DNS config NSH_DNS

View File

@ -131,8 +131,7 @@
static sem_t g_notify_sem; static sem_t g_notify_sem;
#endif #endif
#ifdef CONFIG_NET_IPv6 #if defined(CONFIG_NET_IPv6) && !defined(CONFIG_NET_ICMPv6_AUTOCONF)
#ifndef CONFIG_NET_ICMPv6_AUTOCONF
/* Host IPv6 address */ /* Host IPv6 address */
static const uint16_t g_ipv6_hostaddr[8] = static const uint16_t g_ipv6_hostaddr[8] =
@ -146,7 +145,6 @@ static const uint16_t g_ipv6_hostaddr[8] =
HTONS(CONFIG_NSH_IPv6ADDR_7), HTONS(CONFIG_NSH_IPv6ADDR_7),
HTONS(CONFIG_NSH_IPv6ADDR_8), HTONS(CONFIG_NSH_IPv6ADDR_8),
}; };
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
/* Default routine IPv6 address */ /* Default routine IPv6 address */
@ -175,7 +173,7 @@ static const uint16_t g_ipv6_netmask[8] =
HTONS(CONFIG_NSH_IPv6NETMASK_7), HTONS(CONFIG_NSH_IPv6NETMASK_7),
HTONS(CONFIG_NSH_IPv6NETMASK_8), HTONS(CONFIG_NSH_IPv6NETMASK_8),
}; };
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 && !CONFIG_NET_ICMPv6_AUTOCONF*/
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
@ -260,13 +258,12 @@ static void nsh_netinit_configure(void)
netlib_icmpv6_autoconfiguration(NET_DEVNAME); netlib_icmpv6_autoconfiguration(NET_DEVNAME);
#else #else /* CONFIG_NET_ICMPv6_AUTOCONF */
/* Set up our fixed host address */ /* Set up our fixed host address */
netlib_set_ipv6addr(NET_DEVNAME, netlib_set_ipv6addr(NET_DEVNAME,
(FAR const struct in6_addr *)g_ipv6_hostaddr); (FAR const struct in6_addr *)g_ipv6_hostaddr);
#endif
/* Set up the default router address */ /* Set up the default router address */
@ -277,7 +274,9 @@ static void nsh_netinit_configure(void)
netlib_set_ipv6netmask(NET_DEVNAME, netlib_set_ipv6netmask(NET_DEVNAME,
(FAR const struct in6_addr *)g_ipv6_netmask); (FAR const struct in6_addr *)g_ipv6_netmask);
#endif
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
#endif /* CONFIG_NET_IPv6 */
#if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS) #if defined(CONFIG_NSH_DHCPC) || defined(CONFIG_NSH_DNS)
/* Set up the resolver */ /* Set up the resolver */