Fix IPv6 loopback driver that depended on the removed g_ipv6_allonesaddr. Noted by Masayuki Ishikawa

This commit is contained in:
Gregory Nutt 2017-08-09 06:59:55 -06:00
parent b5f5b07b18
commit 7bb8943a9c
3 changed files with 24 additions and 23 deletions

View File

@ -499,17 +499,14 @@ static int lo_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
* Name: localhost_initialize
*
* Description:
* Initialize the Ethernet controller and driver
* Initialize the localhost, loopback network driver
*
* Parameters:
* intf - In the case where there are multiple EMACs, this value
* identifies which EMAC is to be initialized.
* None
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
int localhost_initialize(void)
@ -554,7 +551,7 @@ int localhost_initialize(void)
#ifdef CONFIG_NET_IPv6
net_ipv6addr_copy(priv->lo_dev.d_ipv6addr, g_lo_ipv6addr);
net_ipv6addr_copy(priv->lo_dev.d_ipv6draddr, g_lo_ipv6addr);
net_ipv6addr_copy(priv->lo_dev.d_ipv6netmask, g_ipv6_alloneaddr);
net_ipv6addr_copy(priv->lo_dev.d_ipv6netmask, g_lo_ipv6mask);
#endif
/* Put the network in the UP state */

View File

@ -51,17 +51,6 @@
#ifdef CONFIG_NET_LOOPBACK
/****************************************************************************
* Public Type Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
@ -82,9 +71,15 @@ EXTERN const char g_lo_hostname[];
/* Local loopback addresses */
#ifdef CONFIG_NET_IPv4
EXTERN const in_addr_t g_lo_ipv4addr;
EXTERN const in_addr_t g_lo_ipv4mask;
#endif
#ifdef CONFIG_NET_IPv6
EXTERN const net_ipv6addr_t g_lo_ipv6addr;
EXTERN const net_ipv6addr_t g_lo_ipv6mask;
#endif
/****************************************************************************
* Public Function Prototypes
@ -94,17 +89,14 @@ EXTERN const net_ipv6addr_t g_lo_ipv6addr;
* Name: localhost_initialize
*
* Description:
* Initialize the Ethernet controller and driver
* Initialize the localhost, loopback network driver
*
* Parameters:
* intf - In the case where there are multiple EMACs, this value
* identifies which EMAC is to be initialized.
* None
*
* Returned Value:
* OK on success; Negated errno on failure.
*
* Assumptions:
*
****************************************************************************/
#ifdef CONFIG_NETDEV_LOOPBACK

View File

@ -1,7 +1,7 @@
/****************************************************************************
* net/loopback/lo_globals.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -49,19 +49,31 @@
* Public Data
****************************************************************************/
#ifdef CONFIG_LIBC_NETDB
/* Local loopback hostname */
const char g_lo_hostname[] = "localhost";
#endif
/* Local loopback addresses */
#ifdef CONFIG_NET_IPv4
const in_addr_t g_lo_ipv4addr = HTONL(0x7f000001);
const in_addr_t g_lo_ipv4mask = HTONL(0xff000000);
#endif
#ifdef CONFIG_NET_IPv6
const net_ipv6addr_t g_lo_ipv6addr =
{
HTONS(0), HTONS(0), HTONS(0), HTONS(0),
HTONS(0), HTONS(0), HTONS(0), HTONS(1)
};
const net_ipv6addr_t g_lo_ipv6mask =
{
HTONS(0xffff), HTONS(0xffff), HTONS(0xffff), HTONS(0xffff),
HTONS(0xffff), HTONS(0xffff), HTONS(0xffff), HTONS(0xffff)
};
#endif
/****************************************************************************
* Public Functions