Forráskód Böngészése

src/cyw43_lwip: Allow DHCP and DNS to be disabled.

Fixes issue #48.
Peter Harper 3 éve
szülő
commit
4be372ccf2
2 módosított fájl, 6 hozzáadás és 2 törlés
  1. 1 1
      src/cyw43.h
  2. 5 1
      src/cyw43_lwip.c

+ 1 - 1
src/cyw43.h

@@ -115,7 +115,7 @@ typedef struct _cyw43_t {
     #if CYW43_LWIP
     // lwIP data
     struct netif netif[2];
-    #if LWIP_IPV4
+    #if LWIP_IPV4 && LWIP_DHCP
     struct dhcp dhcp_client;
     #endif
     #endif

+ 5 - 1
src/cyw43_lwip.c

@@ -217,10 +217,14 @@ void cyw43_cb_tcpip_init(cyw43_t *self, int itf) {
 
     if (itf == CYW43_ITF_STA) {
         #if LWIP_IPV4
+        #if LWIP_DNS
         dns_setserver(0, &ipconfig[3]);
+        #endif
+        #if LWIP_DHCP
         dhcp_set_struct(n, &self->dhcp_client);
         dhcp_start(n);
         #endif
+        #endif
         #if LWIP_IPV6
         ip6_addr_t ip6_allnodes_ll;
         ip6_addr_set_allnodes_linklocal(&ip6_allnodes_ll);
@@ -238,7 +242,7 @@ void cyw43_cb_tcpip_init(cyw43_t *self, int itf) {
 void cyw43_cb_tcpip_deinit(cyw43_t *self, int itf) {
     struct netif *n = &self->netif[itf];
     if (itf == CYW43_ITF_STA) {
-        #if LWIP_IPV4
+        #if LWIP_IPV4 && LWIP_DHCP
         dhcp_stop(n);
         #endif
     } else {