@@ -103,7 +103,9 @@ static void mbed_lwip_socket_callback(struct netconn *nc, enum netconn_evt eh, u
103
103
104
104
/* TCP/IP and Network Interface Initialisation */
105
105
static struct netif lwip_netif ;
106
+ #if LWIP_DHCP
106
107
static bool lwip_dhcp = false;
108
+ #endif
107
109
static char lwip_mac_address [NSAPI_MAC_SIZE ];
108
110
109
111
#if !LWIP_IPV4 || !LWIP_IPV6
@@ -420,6 +422,12 @@ nsapi_error_t mbed_lwip_bringup(bool dhcp, const char *ip, const char *netmask,
420
422
return NSAPI_ERROR_PARAMETER ;
421
423
}
422
424
425
+ #if !LWIP_DHCP
426
+ if (dhcp ) {
427
+ return NSAPI_ERROR_PARAMETER ;
428
+ }
429
+ #endif
430
+
423
431
if (mbed_lwip_init (NULL ) != NSAPI_ERROR_OK ) {
424
432
return NSAPI_ERROR_DEVICE_ERROR ;
425
433
}
@@ -477,7 +485,7 @@ nsapi_error_t mbed_lwip_bringup(bool dhcp, const char *ip, const char *netmask,
477
485
478
486
netif_set_up (& lwip_netif );
479
487
480
- #if LWIP_IPV4
488
+ #if LWIP_IPV4 && LWIP_DHCP
481
489
// Connect to the network
482
490
lwip_dhcp = dhcp ;
483
491
@@ -529,7 +537,7 @@ nsapi_error_t mbed_lwip_bringdown(void)
529
537
return NSAPI_ERROR_PARAMETER ;
530
538
}
531
539
532
- #if LWIP_IPV4
540
+ #if LWIP_IPV4 && LWIP_DNS
533
541
// Disconnect from the network
534
542
if (lwip_dhcp ) {
535
543
dhcp_release (& lwip_netif );
@@ -576,6 +584,7 @@ static nsapi_error_t mbed_lwip_err_remap(err_t err) {
576
584
}
577
585
}
578
586
587
+ #if LWIP_DNS
579
588
/* LWIP network stack implementation */
580
589
static nsapi_error_t mbed_lwip_gethostbyname (nsapi_stack_t * stack , const char * host , nsapi_addr_t * addr , nsapi_version_t version )
581
590
{
@@ -617,6 +626,7 @@ static nsapi_error_t mbed_lwip_gethostbyname(nsapi_stack_t *stack, const char *h
617
626
618
627
return 0 ;
619
628
}
629
+ #endif
620
630
621
631
static nsapi_error_t mbed_lwip_socket_open (nsapi_stack_t * stack , nsapi_socket_t * handle , nsapi_protocol_t proto )
622
632
{
@@ -885,7 +895,9 @@ static void mbed_lwip_socket_attach(nsapi_stack_t *stack, nsapi_socket_t handle,
885
895
886
896
/* LWIP network stack */
887
897
const nsapi_stack_api_t lwip_stack_api = {
898
+ #if LWIP_DNS
888
899
.gethostbyname = mbed_lwip_gethostbyname ,
900
+ #endif
889
901
.socket_open = mbed_lwip_socket_open ,
890
902
.socket_close = mbed_lwip_socket_close ,
891
903
.socket_bind = mbed_lwip_socket_bind ,
0 commit comments