diff --git a/TESTS/network/multihoming/multihoming_asynchronous_dns.cpp b/TESTS/network/multihoming/multihoming_asynchronous_dns.cpp index 0f5e9146d5..1df72db6e3 100644 --- a/TESTS/network/multihoming/multihoming_asynchronous_dns.cpp +++ b/TESTS/network/multihoming/multihoming_asynchronous_dns.cpp @@ -58,7 +58,7 @@ void MULTIHOMING_ASYNCHRONOUS_DNS() for (unsigned int j = 0; j < interface_num; j++) { nsapi_error_t err = get_interface()->gethostbyname_async(dns_test_hosts[i], - mbed::Callback(hostbyname_cb, (void *) &data), interface_name[j]); + mbed::Callback(hostbyname_cb, (void *) &data), NSAPI_UNSPEC, interface_name[j]); TEST_ASSERT(err >= 0); semaphore.wait(); diff --git a/TESTS/network/multihoming/multihoming_synchronous_dns.cpp b/TESTS/network/multihoming/multihoming_synchronous_dns.cpp index 5e253eb128..6cdc1bd605 100644 --- a/TESTS/network/multihoming/multihoming_synchronous_dns.cpp +++ b/TESTS/network/multihoming/multihoming_synchronous_dns.cpp @@ -46,7 +46,7 @@ void MULTIHOMING_SYNCHRONOUS_DNS() SocketAddress address; for (unsigned int j = 0; j < interface_num; j++) { - nsapi_error_t err = get_interface()->gethostbyname(dns_test_hosts[i], &address, interface_name[j]); + nsapi_error_t err = get_interface()->gethostbyname(dns_test_hosts[i], &address, NSAPI_UNSPEC, interface_name[j]); printf("DNS: query interface_name %s %d \n", interface_name[j], j); if (err == NSAPI_ERROR_OK) { diff --git a/UNITTESTS/features/netsocket/NetworkInterface/test_NetworkInterface.cpp b/UNITTESTS/features/netsocket/NetworkInterface/test_NetworkInterface.cpp index 7b9be6dd17..09c63de0fb 100644 --- a/UNITTESTS/features/netsocket/NetworkInterface/test_NetworkInterface.cpp +++ b/UNITTESTS/features/netsocket/NetworkInterface/test_NetworkInterface.cpp @@ -106,7 +106,7 @@ TEST_F(TestNetworkInterface, set_dhcp) TEST_F(TestNetworkInterface, gethostbyname) { SocketAddress a; - EXPECT_EQ(iface->gethostbyname("host", &a, "", NSAPI_UNSPEC), NSAPI_ERROR_OK); + EXPECT_EQ(iface->gethostbyname("host", &a, NSAPI_UNSPEC), NSAPI_ERROR_OK); } @@ -121,7 +121,7 @@ static void my_callback(nsapi_error_t result, SocketAddress *address) TEST_F(TestNetworkInterface, gethostbyname_async) { SocketAddress a; - EXPECT_EQ(iface->gethostbyname_async("host", mbed::callback(my_callback), "", NSAPI_UNSPEC), NSAPI_ERROR_OK); + EXPECT_EQ(iface->gethostbyname_async("host", mbed::callback(my_callback), NSAPI_UNSPEC), NSAPI_ERROR_OK); EXPECT_EQ(iface->gethostbyname_async_cancel(1), NSAPI_ERROR_OK); } diff --git a/UNITTESTS/features/netsocket/NetworkStack/test_NetworkStack.cpp b/UNITTESTS/features/netsocket/NetworkStack/test_NetworkStack.cpp index 20856ca5d1..236b0745dc 100644 --- a/UNITTESTS/features/netsocket/NetworkStack/test_NetworkStack.cpp +++ b/UNITTESTS/features/netsocket/NetworkStack/test_NetworkStack.cpp @@ -153,31 +153,31 @@ TEST_F(TestNetworkStack, gethostbyname) { SocketAddress a; stack->ip_address = std::string("127.0.0.1"); - EXPECT_EQ(stack->gethostbyname("host", &a, "", NSAPI_UNSPEC), NSAPI_ERROR_DNS_FAILURE); + EXPECT_EQ(stack->gethostbyname("host", &a, NSAPI_UNSPEC), NSAPI_ERROR_DNS_FAILURE); } TEST_F(TestNetworkStack, gethostbyname_simple_address) { SocketAddress a; - EXPECT_EQ(stack->gethostbyname("127.0.0.1", &a, "", NSAPI_UNSPEC), NSAPI_ERROR_OK); + EXPECT_EQ(stack->gethostbyname("127.0.0.1", &a, NSAPI_UNSPEC), NSAPI_ERROR_OK); } TEST_F(TestNetworkStack, gethostbyname_simple_address_right_version) { SocketAddress a; - EXPECT_EQ(stack->gethostbyname("127.0.0.1", &a, "", NSAPI_IPv4), NSAPI_ERROR_OK); + EXPECT_EQ(stack->gethostbyname("127.0.0.1", &a, NSAPI_IPv4), NSAPI_ERROR_OK); } TEST_F(TestNetworkStack, gethostbyname_simple_address_wrong_version) { SocketAddress a; - EXPECT_EQ(stack->gethostbyname("127.0.0.1", &a, "", NSAPI_IPv6), NSAPI_ERROR_DNS_FAILURE); + EXPECT_EQ(stack->gethostbyname("127.0.0.1", &a, NSAPI_IPv6), NSAPI_ERROR_DNS_FAILURE); } TEST_F(TestNetworkStack, gethostbyname_empty_host) { SocketAddress a; - EXPECT_EQ(stack->gethostbyname("", &a, "", NSAPI_UNSPEC), NSAPI_ERROR_PARAMETER); + EXPECT_EQ(stack->gethostbyname("", &a, NSAPI_UNSPEC), NSAPI_ERROR_PARAMETER); } /* gethostbyname_async */ @@ -190,7 +190,7 @@ TEST_F(TestNetworkStack, gethostbyname_async_delay) struct equeue_event ptr; equeue_stub.void_ptr = &ptr; equeue_stub.call_cb_immediately = true; - EXPECT_EQ(stack->gethostbyname_async("localhost", mbed::callback(my_callback), "", NSAPI_UNSPEC), NSAPI_ERROR_DNS_FAILURE); + EXPECT_EQ(stack->gethostbyname_async("localhost", mbed::callback(my_callback), NSAPI_UNSPEC), NSAPI_ERROR_DNS_FAILURE); EXPECT_EQ(callin_callback(1, mbed::callback(noarg_callback)), NSAPI_ERROR_OK); EXPECT_TRUE(noarg_callback_is_called); EXPECT_FALSE(callback_is_called); @@ -204,7 +204,7 @@ TEST_F(TestNetworkStack, gethostbyname_async) struct equeue_event ptr; equeue_stub.void_ptr = &ptr; equeue_stub.call_cb_immediately = true; - EXPECT_EQ(stack->gethostbyname_async("localhost", mbed::callback(my_callback), "", NSAPI_UNSPEC), NSAPI_ERROR_DNS_FAILURE); + EXPECT_EQ(stack->gethostbyname_async("localhost", mbed::callback(my_callback), NSAPI_UNSPEC), NSAPI_ERROR_DNS_FAILURE); EXPECT_EQ(callin_callback(0, mbed::callback(noarg_callback)), NSAPI_ERROR_OK); EXPECT_TRUE(noarg_callback_is_called); EXPECT_FALSE(callback_is_called); @@ -214,9 +214,9 @@ TEST_F(TestNetworkStack, gethostbyname_async_eventqueue_simple_address) { SocketAddress a; stack->ip_address = std::string("127.0.0.1"); - EXPECT_EQ(stack->gethostbyname_async("127.0.0.1", mbed::callback(my_callback), "", NSAPI_IPv6), NSAPI_ERROR_DNS_FAILURE); + EXPECT_EQ(stack->gethostbyname_async("127.0.0.1", mbed::callback(my_callback), NSAPI_IPv6), NSAPI_ERROR_DNS_FAILURE); EXPECT_FALSE(callback_is_called); - EXPECT_EQ(stack->gethostbyname_async("127.0.0.1", mbed::callback(my_callback), "", NSAPI_IPv4), NSAPI_ERROR_OK); + EXPECT_EQ(stack->gethostbyname_async("127.0.0.1", mbed::callback(my_callback), NSAPI_IPv4), NSAPI_ERROR_OK); EXPECT_TRUE(callback_is_called); EXPECT_EQ(result_received, NSAPI_ERROR_OK); EXPECT_EQ(std::string(address_received.get_ip_address()), stack->ip_address); @@ -225,7 +225,7 @@ TEST_F(TestNetworkStack, gethostbyname_async_eventqueue_simple_address) TEST_F(TestNetworkStack, gethostbyname_async_empty_host) { SocketAddress a; - EXPECT_EQ(stack->gethostbyname_async("", mbed::callback(my_callback), "", NSAPI_UNSPEC), NSAPI_ERROR_PARAMETER); + EXPECT_EQ(stack->gethostbyname_async("", mbed::callback(my_callback), NSAPI_UNSPEC), NSAPI_ERROR_PARAMETER); } TEST_F(TestNetworkStack, getstackopt) diff --git a/UNITTESTS/stubs/NetworkInterface_stub.cpp b/UNITTESTS/stubs/NetworkInterface_stub.cpp index a5a0b7ecde..50009573be 100644 --- a/UNITTESTS/stubs/NetworkInterface_stub.cpp +++ b/UNITTESTS/stubs/NetworkInterface_stub.cpp @@ -52,7 +52,7 @@ nsapi_error_t NetworkInterface::set_dhcp(bool dhcp) } // DNS operations go through the underlying stack by default -nsapi_error_t NetworkInterface::gethostbyname(const char *name, SocketAddress *address, const char *interface_name, nsapi_version_t version) +nsapi_error_t NetworkInterface::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name) { return NSAPI_ERROR_UNSUPPORTED; } @@ -77,7 +77,7 @@ nsapi_error_t NetworkInterface::set_blocking(bool blocking) return NSAPI_ERROR_UNSUPPORTED; } -nsapi_value_or_error_t NetworkInterface::gethostbyname_async(char const *, mbed::Callback, const char *interface_name, nsapi_version) +nsapi_value_or_error_t NetworkInterface::gethostbyname_async(char const *, mbed::Callback, nsapi_version, const char *interface_name) { return NSAPI_ERROR_UNSUPPORTED; } diff --git a/UNITTESTS/stubs/NetworkStack_stub.cpp b/UNITTESTS/stubs/NetworkStack_stub.cpp index e3ff3358d5..31f3b91533 100644 --- a/UNITTESTS/stubs/NetworkStack_stub.cpp +++ b/UNITTESTS/stubs/NetworkStack_stub.cpp @@ -22,7 +22,7 @@ #include // Default NetworkStack operations -nsapi_error_t NetworkStack::gethostbyname(const char *name, SocketAddress *address, const char *interface_name, nsapi_version_t version) +nsapi_error_t NetworkStack::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name) { return NSAPI_ERROR_OK; } @@ -68,8 +68,8 @@ NetworkStack *nsapi_create_stack(NetworkStack *stack) return NULL; } -nsapi_value_or_error_t NetworkStack::gethostbyname_async(const char *host, hostbyname_cb_t callback, const char *interface_name, - nsapi_version_t version) +nsapi_value_or_error_t NetworkStack::gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version, + const char *interface_name) { return NSAPI_ERROR_UNSUPPORTED; } diff --git a/UNITTESTS/stubs/NetworkStack_stub.h b/UNITTESTS/stubs/NetworkStack_stub.h index 6ea08cde48..68845aceca 100644 --- a/UNITTESTS/stubs/NetworkStack_stub.h +++ b/UNITTESTS/stubs/NetworkStack_stub.h @@ -37,12 +37,12 @@ public: return "127.0.0.1"; } virtual nsapi_error_t gethostbyname(const char *host, - SocketAddress *address, const char *interface_name, nsapi_version_t version) + SocketAddress *address, nsapi_version_t version, const char *interface_name) { return return_value; } - virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, const char *interface_name, - nsapi_version_t version) + virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version, + const char *interface_name) { return return_value; } diff --git a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp index 6ddf7a86e0..60cea8a5eb 100644 --- a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp +++ b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp @@ -468,7 +468,7 @@ const char *UBLOX_AT_CellularStack::get_ip_address() return _ip; } -nsapi_error_t UBLOX_AT_CellularStack::gethostbyname(const char *host, SocketAddress *address, const char *interface_name, nsapi_version_t version) +nsapi_error_t UBLOX_AT_CellularStack::gethostbyname(const char *host, SocketAddress *address, nsapi_version_t version, const char *interface_name) { char ipAddress[NSAPI_IP_SIZE]; nsapi_error_t err = NSAPI_ERROR_NO_CONNECTION; diff --git a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h index 14e4356fd2..3638559670 100644 --- a/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h +++ b/features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.h @@ -33,7 +33,7 @@ public: virtual const char *get_ip_address(); virtual nsapi_error_t gethostbyname(const char *host, - SocketAddress *address, const char *interface_name = NULL, nsapi_version_t version = NSAPI_UNSPEC); + SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC, const char *interface_name = NULL); protected: virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog); diff --git a/features/netsocket/DNS.h b/features/netsocket/DNS.h index c8d0efcb6a..3c907a9729 100644 --- a/features/netsocket/DNS.h +++ b/features/netsocket/DNS.h @@ -35,13 +35,13 @@ public: * * @param host Hostname to resolve. * @param address Pointer to a SocketAddress to store the result. - * @param interface_name Network interface name * @param version IP version of address to resolve, NSAPI_UNSPEC indicates * version is chosen by the stack (defaults to NSAPI_UNSPEC). + * @param interface_name Network interface name * @return NSAPI_ERROR_OK on success, negative error code on failure. */ virtual nsapi_error_t gethostbyname(const char *host, - SocketAddress *address, const char *interface_name = NULL, nsapi_version_t version = NSAPI_UNSPEC) = 0; + SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC, const char *interface_name = NULL) = 0; /** Hostname translation callback for gethostbyname_async. * * The callback is called after DNS resolution completes, or a failure occurs. @@ -72,16 +72,16 @@ public: * * @param host Hostname to resolve. * @param callback Callback that is called to return the result. - * @param interface_name Network interface name * @param version IP version of address to resolve. NSAPI_UNSPEC indicates that the * version is chosen by the stack (defaults to NSAPI_UNSPEC). + * @param interface_name Network interface name * @return NSAPI_ERROR_OK on immediate success, * negative error code on immediate failure or * a positive unique ID that represents the hostname translation operation * and can be passed to cancel. */ - virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, const char *interface_name = NULL, - nsapi_version_t version = NSAPI_UNSPEC) = 0; + virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version = NSAPI_UNSPEC, + const char *interface_name = NULL) = 0; /** Cancel asynchronous hostname translation. * diff --git a/features/netsocket/NetworkInterface.cpp b/features/netsocket/NetworkInterface.cpp index 540e195cbf..e189218a81 100644 --- a/features/netsocket/NetworkInterface.cpp +++ b/features/netsocket/NetworkInterface.cpp @@ -66,14 +66,14 @@ nsapi_error_t NetworkInterface::set_dhcp(bool dhcp) } } -nsapi_error_t NetworkInterface::gethostbyname(const char *name, SocketAddress *address, const char *interface_name, nsapi_version_t version) +nsapi_error_t NetworkInterface::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name) { - return get_stack()->gethostbyname(name, address, interface_name, version); + return get_stack()->gethostbyname(name, address, version, interface_name); } -nsapi_value_or_error_t NetworkInterface::gethostbyname_async(const char *host, hostbyname_cb_t callback, const char *interface_name, nsapi_version_t version) +nsapi_value_or_error_t NetworkInterface::gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version, const char *interface_name) { - return get_stack()->gethostbyname_async(host, callback, interface_name, version); + return get_stack()->gethostbyname_async(host, callback, version, interface_name); } nsapi_error_t NetworkInterface::gethostbyname_async_cancel(int id) diff --git a/features/netsocket/NetworkInterface.h b/features/netsocket/NetworkInterface.h index 6abf5833e8..fb372fa849 100644 --- a/features/netsocket/NetworkInterface.h +++ b/features/netsocket/NetworkInterface.h @@ -194,13 +194,13 @@ public: * * @param host Hostname to resolve. * @param address Pointer to a SocketAddress to store the result. - * @param interface_name Network interface name * @param version IP version of address to resolve, NSAPI_UNSPEC indicates * version is chosen by the stack (defaults to NSAPI_UNSPEC). + * @param interface_name Network interface name * @return NSAPI_ERROR_OK on success, negative error code on failure. */ virtual nsapi_error_t gethostbyname(const char *host, - SocketAddress *address, const char *interface_name = NULL, nsapi_version_t version = NSAPI_UNSPEC); + SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC, const char *interface_name = NULL); /** Hostname translation callback (for use with gethostbyname_async()). * @@ -232,16 +232,16 @@ public: * * @param host Hostname to resolve. * @param callback Callback that is called for result. - * @param interface_name Network interface name * @param version IP version of address to resolve, NSAPI_UNSPEC indicates * version is chosen by the stack (defaults to NSAPI_UNSPEC). + * @param interface_name Network interface name * @return 0 on immediate success, * negative error code on immediate failure or * a positive unique id that represents the hostname translation operation * and can be passed to cancel. */ - virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, const char *interface_name = NULL, - nsapi_version_t version = NSAPI_UNSPEC); + virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version = NSAPI_UNSPEC, + const char *interface_name = NULL); /** Cancel asynchronous hostname translation. * diff --git a/features/netsocket/NetworkStack.cpp b/features/netsocket/NetworkStack.cpp index 457ff7c2ae..312554caa2 100644 --- a/features/netsocket/NetworkStack.cpp +++ b/features/netsocket/NetworkStack.cpp @@ -34,7 +34,7 @@ const char *NetworkStack::get_ip_address_if(const char *interface_name) } -nsapi_error_t NetworkStack::gethostbyname(const char *name, SocketAddress *address, const char *interface_name, nsapi_version_t version) +nsapi_error_t NetworkStack::gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name) { if (name[0] == '\0') { return NSAPI_ERROR_PARAMETER; @@ -61,7 +61,7 @@ nsapi_error_t NetworkStack::gethostbyname(const char *name, SocketAddress *addre return nsapi_dns_query(this, name, address, interface_name, version); } -nsapi_value_or_error_t NetworkStack::gethostbyname_async(const char *name, hostbyname_cb_t callback, const char *interface_name, nsapi_version_t version) +nsapi_value_or_error_t NetworkStack::gethostbyname_async(const char *name, hostbyname_cb_t callback, nsapi_version_t version, const char *interface_name) { SocketAddress address; @@ -184,10 +184,10 @@ public: return address->get_ip_address(); } - virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, const char *interface_name, nsapi_version_t version) + virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version, const char *interface_name) { if (!_stack_api()->gethostbyname) { - return NetworkStack::gethostbyname(name, address, interface_name, version); + return NetworkStack::gethostbyname(name, address, version, interface_name); } nsapi_addr_t addr = {NSAPI_UNSPEC, 0}; diff --git a/features/netsocket/NetworkStack.h b/features/netsocket/NetworkStack.h index f68266d76e..a9cc6e5bc4 100644 --- a/features/netsocket/NetworkStack.h +++ b/features/netsocket/NetworkStack.h @@ -67,12 +67,12 @@ public: * @param host Hostname to resolve * @param address Pointer to a SocketAddress to store the result. * @param version IP version of address to resolve, NSAPI_UNSPEC indicates - * @param interface_name Network interface_name * version is chosen by the stack (defaults to NSAPI_UNSPEC) + * @param interface_name Network interface_name * @return NSAPI_ERROR_OK on success, negative error code on failure */ virtual nsapi_error_t gethostbyname(const char *host, - SocketAddress *address, const char *interface_name = NULL, nsapi_version_t version = NSAPI_UNSPEC); + SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC, const char *interface_name = NULL); /** Hostname translation callback (asynchronous) * @@ -104,16 +104,16 @@ public: * * @param host Hostname to resolve * @param callback Callback that is called for result - * @param interface_name Network interface name * @param version IP version of address to resolve, NSAPI_UNSPEC indicates * version is chosen by the stack (defaults to NSAPI_UNSPEC) + * @param interface_name Network interface_name * @return 0 on immediate success, * negative error code on immediate failure or * a positive unique id that represents the hostname translation operation * and can be passed to cancel */ - virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, const char *interface_name = NULL, - nsapi_version_t version = NSAPI_UNSPEC); + virtual nsapi_value_or_error_t gethostbyname_async(const char *host, hostbyname_cb_t callback, nsapi_version_t version = NSAPI_UNSPEC, + const char *interface_name = NULL); /** Cancels asynchronous hostname translation * diff --git a/features/netsocket/SocketAddress.cpp b/features/netsocket/SocketAddress.cpp index 0025925114..2d0cb75bc8 100644 --- a/features/netsocket/SocketAddress.cpp +++ b/features/netsocket/SocketAddress.cpp @@ -190,7 +190,7 @@ void SocketAddress::_SocketAddress(NetworkStack *iface, const char *host, uint16 _ip_address = NULL; // gethostbyname must check for literals, so can call it directly - int err = iface->gethostbyname(host, this, NULL); + int err = iface->gethostbyname(host, this); _port = port; if (err) { _addr = nsapi_addr_t(); diff --git a/features/netsocket/TCPSocket.cpp b/features/netsocket/TCPSocket.cpp index 47a12b79bd..02c29095f8 100644 --- a/features/netsocket/TCPSocket.cpp +++ b/features/netsocket/TCPSocket.cpp @@ -114,7 +114,7 @@ nsapi_error_t TCPSocket::connect(const char *host, uint16_t port) if (!strcmp(_interface_name, "")) { err = _stack->gethostbyname(host, &address); } else { - err = _stack->gethostbyname(host, &address, _interface_name); + err = _stack->gethostbyname(host, &address, NSAPI_UNSPEC, _interface_name); } if (err) { return NSAPI_ERROR_DNS_FAILURE; diff --git a/features/netsocket/UDPSocket.cpp b/features/netsocket/UDPSocket.cpp index c7ecf632b8..d5041144dc 100644 --- a/features/netsocket/UDPSocket.cpp +++ b/features/netsocket/UDPSocket.cpp @@ -48,7 +48,7 @@ nsapi_size_or_error_t UDPSocket::sendto(const char *host, uint16_t port, const v if (!strcmp(_interface_name, "")) { err = _stack->gethostbyname(host, &address); } else { - err = _stack->gethostbyname(host, &address, _interface_name); + err = _stack->gethostbyname(host, &address, NSAPI_UNSPEC, _interface_name); } if (err) {