mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
emulation on host: fix incorrect lwIP DNS implementation (#8627)
* emulation on host: fix incorrect lwIP DNS implementation +initialize netif0, make ipv6 example unfail
This commit is contained in:
parent
a8e3786d38
commit
00f5f2acc4
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "MocklwIP.h"
|
#include "MocklwIP.h"
|
||||||
|
|
||||||
|
#include <lwip/dns.h>
|
||||||
|
|
||||||
esp8266::AddressListImplementation::AddressList addrList;
|
esp8266::AddressListImplementation::AddressList addrList;
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -57,4 +59,18 @@ extern "C"
|
|||||||
return &netif0;
|
return &netif0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dns_setserver(u8_t numdns, const ip_addr_t* dnsserver)
|
||||||
|
{
|
||||||
|
(void)numdns;
|
||||||
|
(void)dnsserver;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ip_addr_t* dns_getserver(u8_t numdns)
|
||||||
|
{
|
||||||
|
(void)numdns;
|
||||||
|
static ip_addr_t addr;
|
||||||
|
IP4_ADDR(&addr, 127, 0, 0, 1);
|
||||||
|
return &addr;
|
||||||
|
}
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
@ -136,8 +136,7 @@ extern "C"
|
|||||||
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next)
|
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next)
|
||||||
{
|
{
|
||||||
mockverbose("host: interface: %s", ifa->ifa_name);
|
mockverbose("host: interface: %s", ifa->ifa_name);
|
||||||
if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET // ip_info is IPv4 only
|
if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) // ip_info is IPv4 only
|
||||||
)
|
|
||||||
{
|
{
|
||||||
auto test_ipv4
|
auto test_ipv4
|
||||||
= lwip_ntohl(*(uint32_t*)&((struct sockaddr_in*)ifa->ifa_addr)->sin_addr);
|
= lwip_ntohl(*(uint32_t*)&((struct sockaddr_in*)ifa->ifa_addr)->sin_addr);
|
||||||
@ -179,13 +178,13 @@ extern "C"
|
|||||||
info->ip.addr = ipv4;
|
info->ip.addr = ipv4;
|
||||||
info->netmask.addr = mask;
|
info->netmask.addr = mask;
|
||||||
info->gw.addr = ipv4;
|
info->gw.addr = ipv4;
|
||||||
|
}
|
||||||
|
|
||||||
netif0.ip_addr.addr = ipv4;
|
netif0.ip_addr.addr = ipv4;
|
||||||
netif0.netmask.addr = mask;
|
netif0.netmask.addr = mask;
|
||||||
netif0.gw.addr = ipv4;
|
netif0.gw.addr = ipv4;
|
||||||
netif0.flags = NETIF_FLAG_IGMP | NETIF_FLAG_UP | NETIF_FLAG_LINK_UP;
|
netif0.flags = NETIF_FLAG_IGMP | NETIF_FLAG_UP | NETIF_FLAG_LINK_UP;
|
||||||
netif0.next = nullptr;
|
netif0.next = nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -418,19 +417,6 @@ extern "C"
|
|||||||
(void)intr;
|
(void)intr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dns_setserver(u8_t numdns, ip_addr_t* dnsserver)
|
|
||||||
{
|
|
||||||
(void)numdns;
|
|
||||||
(void)dnsserver;
|
|
||||||
}
|
|
||||||
|
|
||||||
ip_addr_t dns_getserver(u8_t numdns)
|
|
||||||
{
|
|
||||||
(void)numdns;
|
|
||||||
ip_addr_t addr = { 0x7f000001 };
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <smartconfig.h>
|
#include <smartconfig.h>
|
||||||
bool smartconfig_start(sc_callback_t cb, ...)
|
bool smartconfig_start(sc_callback_t cb, ...)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user