From 34ef11630c2660bdb8643ebe7e87713944ab20c4 Mon Sep 17 00:00:00 2001 From: Teemu Kultala Date: Thu, 22 Feb 2018 10:54:36 +0200 Subject: [PATCH] fix issue 6150 by always setting net interface UP in mbed_set_dhcp --- features/FEATURE_LWIP/lwip-interface/lwip_stack.c | 4 +--- .../cellular/generic_modem_driver/PPPCellularInterface.cpp | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/features/FEATURE_LWIP/lwip-interface/lwip_stack.c b/features/FEATURE_LWIP/lwip-interface/lwip_stack.c index 85f2918986..f1e2c7b9cf 100644 --- a/features/FEATURE_LWIP/lwip-interface/lwip_stack.c +++ b/features/FEATURE_LWIP/lwip-interface/lwip_stack.c @@ -444,9 +444,7 @@ static bool lwip_ppp = false; static nsapi_error_t mbed_set_dhcp(struct netif *lwip_netif) { - if (!lwip_ppp) { - netif_set_up(lwip_netif); - } + netif_set_up(lwip_netif); #if LWIP_DHCP if (lwip_dhcp && lwip_dhcp_has_to_be_set) { diff --git a/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp b/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp index fe64baa819..996e78b2d4 100644 --- a/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp +++ b/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.cpp @@ -702,6 +702,9 @@ nsapi_error_t PPPCellularInterface::connect() * mbed_ppp_init() is a blocking call, it will block until * connected, or timeout after 30 seconds*/ retcode = nsapi_ppp_connect(_fh, callback(this, &PPPCellularInterface::ppp_status_cb), _uname, _pwd, _stack); + if (retcode == NSAPI_ERROR_OK && _connect_is_blocking) { + _connect_status = NSAPI_STATUS_GLOBAL_UP; + } } while ((_connect_status == NSAPI_STATUS_CONNECTING && _connect_is_blocking) && apn_config && *apn_config);