Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/host/common/MocklwIP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "MocklwIP.h"

#include <lwip/dns.h>

esp8266::AddressListImplementation::AddressList addrList;

extern "C"
Expand Down Expand Up @@ -57,4 +59,18 @@ extern "C"
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"
28 changes: 7 additions & 21 deletions tests/host/common/user_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ extern "C"
for (ifa = ifAddrStruct; ifa != NULL; ifa = ifa->ifa_next)
{
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
= lwip_ntohl(*(uint32_t*)&((struct sockaddr_in*)ifa->ifa_addr)->sin_addr);
Expand Down Expand Up @@ -179,14 +178,14 @@ extern "C"
info->ip.addr = ipv4;
info->netmask.addr = mask;
info->gw.addr = ipv4;

netif0.ip_addr.addr = ipv4;
netif0.netmask.addr = mask;
netif0.gw.addr = ipv4;
netif0.flags = NETIF_FLAG_IGMP | NETIF_FLAG_UP | NETIF_FLAG_LINK_UP;
netif0.next = nullptr;
}

netif0.ip_addr.addr = ipv4;
netif0.netmask.addr = mask;
netif0.gw.addr = ipv4;
netif0.flags = NETIF_FLAG_IGMP | NETIF_FLAG_UP | NETIF_FLAG_LINK_UP;
netif0.next = nullptr;

return true;
}

Expand Down Expand Up @@ -418,19 +417,6 @@ extern "C"
(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>
bool smartconfig_start(sc_callback_t cb, ...)
{
Expand Down