DHCP Service IPADDR Pool
Posted: Sat Jun 24, 2023 12:25 am
Hello, I'm testing and learning the IP Internal Network example from the ESP-IDF example projects. I'm currently trying to figure out how or where the DHCP pool is assigned for the root node. I understand that the root node initializes the DHCP client service to request an external IP, then initializes the DHCP service for the mesh to assign internal IPs, and for internal IPs uses the 10.0.0.0/8 network by default in the example. Where is this network address (10.0.0.0) located/set? This is the contents of the first few lines of app_main():
I'm kind of lost. I tried following the function pointer for ip_event_handler but could not find where event_data was passed and work backwards to determine the IP address. Any help is appreciated, thanks.
- ESP_ERROR_CHECK(nvs_flash_init());
- /* tcpip initialization */
- ESP_ERROR_CHECK(esp_netif_init());
- /* event initialization */
- ESP_ERROR_CHECK(esp_event_loop_create_default());
- /* crete network interfaces for mesh (only station instance saved for further manipulation, soft AP instance ignored */
- ESP_ERROR_CHECK(mesh_netifs_init(recv_cb));
- /* wifi initialization */
- wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT();
- ESP_ERROR_CHECK(esp_wifi_init(&config));
- ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &ip_event_handler, NULL));
- ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_FLASH));
- ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE));
- ESP_ERROR_CHECK(esp_wifi_start());