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:
Fernando Governatore 2017-08-03 22:34:59 -03:00
parent 9523e872f8
commit be7cabd94d
4 changed files with 19 additions and 12 deletions

View file

@ -40,6 +40,11 @@ DEFINE_TESTCASE(04_wifi_basic, DUAL)
static void server_task(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);
char buf[BUF_SIZE];
struct netconn *nc = netconn_new(NETCONN_TCP);
TEST_ASSERT_TRUE_MESSAGE(nc != 0, "Failed to allocate socket");
@ -103,10 +108,6 @@ static void a_04_wifi_basic(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(server_task, "setver_task", 1024, NULL, 2, NULL);
}