IPv6: Add a netmaks for the local link address

This commit is contained in:
Gregory Nutt 2015-02-05 05:43:57 -06:00
parent 453c25cdbb
commit 6f3f43d930
3 changed files with 17 additions and 7 deletions

View File

@ -220,16 +220,17 @@ extern "C"
/* Well-known IP addresses */
#ifdef CONFIG_NET_IPv4
EXTERN const in_addr_t g_ipv4_alloneaddr;
EXTERN const in_addr_t g_ipv4_allzeroaddr;
EXTERN const in_addr_t g_ipv4_alloneaddr; /* An address of all ones */
EXTERN const in_addr_t g_ipv4_allzeroaddr; /* An address of all zeroes */
#endif
#ifdef CONFIG_NET_IPv6
EXTERN const net_ipv6addr_t g_ipv6_alloneaddr;
EXTERN const net_ipv6addr_t g_ipv6_allzeroaddr;
EXTERN const net_ipv6addr_t g_ipv6_alloneaddr; /* An address of all ones */
EXTERN const net_ipv6addr_t g_ipv6_allzeroaddr; /* An address of all zeroes */
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
EXTERN const net_ipv6addr_t g_ipv6_allnodes; /* All link local nodes */
EXTERN const net_ipv6addr_t g_ipv6_allrouters; /* All link local routers */
EXTERN const net_ipv6addr_t g_ipv6_llnetmask; /* Netmask for local link address */
#endif
#endif

View File

@ -85,12 +85,12 @@ uint8_t g_reassembly_timer;
#ifdef CONFIG_NET_IPv6
const net_ipv6addr_t g_ipv6_alloneaddr =
const net_ipv6addr_t g_ipv6_alloneaddr = /* An address of all ones */
{
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
};
const net_ipv6addr_t g_ipv6_allzeroaddr =
const net_ipv6addr_t g_ipv6_allzeroaddr = /* An address of all zeroes */
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
};
@ -112,6 +112,11 @@ const net_ipv6addr_t g_ipv6_allrouters = /* All link local routers */
HTONS(0x0002)
};
const net_ipv6addr_t g_ipv6_llnetmask = /* Netmask for local link address */
{
0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000
};
#ifdef CONFIG_NET_ETHERNET
/* IPv6 Multi-cast Ethernet addresses. Formed from the 16-bit prefix:

View File

@ -515,8 +515,12 @@ int icmpv6_autoconfig(FAR struct net_driver_s *dev)
netdev_ifdown(dev);
}
/* Set a netmask for the local link address */
net_ipv6addr_copy(dev->d_ipv6netmask, g_ipv6_llnetmask);
/* Leave the network up and return success (even though things did not
* work out quite the way we wanted.
* work out quite the way we wanted).
*/
net_unlock(save);