- 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());
DHCP Service IPADDR Pool
DHCP Service IPADDR Pool
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.
Re: DHCP Service IPADDR Pool
I figured it out; it's in mesh_netif.c. I'm not sure why I passed over this file initially; it cause me a lot of unnecessary headache. The struct is declared:
Root node assumes this IP; child nodes check the ARP table and increment until an address is available, then send the DHCPREQUEST to root.
- const esp_netif_ip_info_t g_mesh_netif_subnet_ip = { // mesh subnet IP info
- .ip = { .addr = ESP_IP4TOADDR( 192, 168, 0, 1) },
- .gw = { .addr = ESP_IP4TOADDR( 192, 168, 0, 1) },
- .netmask = { .addr = ESP_IP4TOADDR( 255, 255, 255, 0) },
- };
Who is online
Users browsing this forum: iancoullie, snutw_ and 78 guests