@@ -230,7 +230,7 @@ char *LWIP::Interface::get_gateway(char *buf, nsapi_size_t buflen)
230
230
231
231
LWIP::Interface::Interface () :
232
232
hw(NULL ), has_addr_state(0 ),
233
- connected(false ), dhcp (false ), ppp(false )
233
+ connected(false ), dhcp_started (false ), ppp(false )
234
234
{
235
235
memset (&netif, 0 , sizeof netif);
236
236
@@ -271,7 +271,6 @@ nsapi_error_t LWIP::add_ethernet_interface(EMAC &emac, bool default_if, OnboardN
271
271
return NSAPI_ERROR_NO_MEMORY;
272
272
}
273
273
interface->emac = &emac;
274
- interface->dhcp = true ;
275
274
interface->ppp = false ;
276
275
277
276
#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
@@ -328,7 +327,6 @@ nsapi_error_t LWIP::_add_ppp_interface(void *hw, bool default_if, LWIP::Interfac
328
327
return NSAPI_ERROR_NO_MEMORY;
329
328
}
330
329
interface->hw = hw;
331
- interface->dhcp = true ;
332
330
interface->ppp = true ;
333
331
334
332
ret = ppp_lwip_if_init (hw, &interface->netif );
@@ -427,13 +425,12 @@ nsapi_error_t LWIP::Interface::bringup(bool dhcp, const char *ip, const char *ne
427
425
#if LWIP_DHCP
428
426
if (stack != IPV6_STACK) {
429
427
// Connect to the network
430
- dhcp = dhcp;
431
-
432
428
if (dhcp) {
433
429
err_t err = dhcp_start (&netif);
434
430
if (err) {
435
431
return NSAPI_ERROR_DHCP_FAILURE;
436
432
}
433
+ dhcp_started = true ;
437
434
}
438
435
}
439
436
#endif
@@ -446,8 +443,8 @@ nsapi_error_t LWIP::Interface::bringup(bool dhcp, const char *ip, const char *ne
446
443
}
447
444
return NSAPI_ERROR_DHCP_FAILURE;
448
445
}
449
- connected = true ;
450
446
}
447
+ connected = true ;
451
448
452
449
#if PREF_ADDR_TIMEOUT
453
450
if (stack != IPV4_STACK && stack != IPV6_STACK) {
@@ -482,10 +479,10 @@ nsapi_error_t LWIP::Interface::bringdown()
482
479
483
480
#if LWIP_DHCP
484
481
// Disconnect from the network
485
- if (dhcp ) {
482
+ if (dhcp_started ) {
486
483
dhcp_release (&netif);
487
484
dhcp_stop (&netif);
488
- dhcp = false ;
485
+ dhcp_started = false ;
489
486
}
490
487
#endif
491
488
0 commit comments