DHCP Allows selecting the DHCP server's network interface
This changes the parameters of dhcpserver_start. Besides that, dhcpserver_start should only be called after user_init has finished, else the call sdk_system_get_netif(SOFTAP_IF) will return NULL.
This commit is contained in:
parent
9523e872f8
commit
be7cabd94d
4 changed files with 19 additions and 12 deletions
|
|
@ -48,10 +48,6 @@ void user_init(void)
|
|||
};
|
||||
sdk_wifi_softap_set_config(&ap_config);
|
||||
|
||||
ip_addr_t first_client_ip;
|
||||
IP4_ADDR(&first_client_ip, 172, 16, 0, 2);
|
||||
dhcpserver_start(&first_client_ip, 4);
|
||||
|
||||
xTaskCreate(telnetTask, "telnetTask", 512, NULL, 2, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -60,6 +56,10 @@ void user_init(void)
|
|||
*/
|
||||
static void telnetTask(void *pvParameters)
|
||||
{
|
||||
ip_addr_t first_client_ip;
|
||||
IP4_ADDR(&first_client_ip, 172, 16, 0, 2);
|
||||
dhcpserver_start(sdk_system_get_netif(SOFTAP_IF), &first_client_ip, 4);
|
||||
|
||||
struct netconn *nc = netconn_new (NETCONN_TCP);
|
||||
if(!nc) {
|
||||
printf("Status monitor: Failed to allocate socket.\r\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue