Просмотр исходного кода

lwip: fix build with CONFIG_LWIP_DHCPS disabled

Also added example build configuration for this option.
Mahavir Jain 3 лет назад
Родитель
Сommit
467e9c07d6

+ 2 - 0
components/esp_netif/include/esp_netif_sta_list.h

@@ -42,6 +42,8 @@ typedef struct {
 /**
  * @brief  Get IP information for stations connected to the Wi-Fi AP interface
  *
+ * @note   If `CONFIG_LWIP_DHCPS` is disabled then `ip` address field will not be populated in sta list
+ *
  * @warning This API works only for the default Wi-Fi AP interface, i.e. esp-netif with key="WIFI_AP_DEF"
  *
  * @param[in]   wifi_sta_list Wi-Fi station info list, returned from esp_wifi_ap_get_sta_list()

+ 2 - 0
components/esp_netif/lwip/esp_netif_sta_list.c

@@ -29,7 +29,9 @@ esp_err_t esp_netif_get_sta_list(const wifi_sta_list_t *wifi_sta_list, esp_netif
     netif_sta_list->num = wifi_sta_list->num;
     for (int i = 0; i < wifi_sta_list->num; i++) {
         memcpy(netif_sta_list->sta[i].mac, wifi_sta_list->sta[i].mac, 6);
+#if CONFIG_LWIP_DHCPS
         dhcp_search_ip_on_mac(ap->dhcps, netif_sta_list->sta[i].mac, (ip4_addr_t*)&netif_sta_list->sta[i].ip);
+#endif
     }
 
     return ESP_OK;

+ 1 - 0
examples/protocols/sockets/tcp_server/sdkconfig.ci.1

@@ -2,3 +2,4 @@ CONFIG_EXAMPLE_IPV4=y
 CONFIG_EXAMPLE_IPV6=n
 CONFIG_EXAMPLE_CONNECT_IPV6=n
 CONFIG_LWIP_IPV6=n
+CONFIG_LWIP_DHCPS=n