mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 03:07:21 +02:00
Fix(dhcps):fix dhcp subnet option api dos not work issue
This commit is contained in:
@ -1931,6 +1931,23 @@ esp_err_t esp_netif_dhcps_option_api(esp_netif_api_msg_t *msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESP_NETIF_SUBNET_MASK: {
|
case ESP_NETIF_SUBNET_MASK: {
|
||||||
|
esp_netif_ip_info_t *default_ip = esp_netif->ip_info;
|
||||||
|
ip4_addr_t *config_netmask = (ip4_addr_t *)opt->val;
|
||||||
|
if (!memcmp(&default_ip->netmask, config_netmask, sizeof(struct ip4_addr))) {
|
||||||
|
ESP_LOGE(TAG, "Please use esp_netif_set_ip_info interface to configure subnet mask");
|
||||||
|
/*
|
||||||
|
* This API directly changes the subnet mask of dhcp server
|
||||||
|
* but the subnet mask of the network interface has not changed
|
||||||
|
* If you need to change the subnet mask of dhcp server
|
||||||
|
* you need to change the subnet mask of the network interface first.
|
||||||
|
* If the subnet mask of dhcp server is changed
|
||||||
|
* and the subnet mask of network interface is inconsistent
|
||||||
|
* with the subnet mask of dhcp sever, it may lead to the failure of sending packets.
|
||||||
|
* If want to configure the subnet mask of dhcp server
|
||||||
|
* please use esp_netif_set_ip_info to change the subnet mask of network interface first.
|
||||||
|
*/
|
||||||
|
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
|
||||||
|
}
|
||||||
memcpy(opt_info, opt->val, opt->len);
|
memcpy(opt_info, opt->val, opt->len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1941,7 +1958,7 @@ esp_err_t esp_netif_dhcps_option_api(esp_netif_api_msg_t *msg)
|
|||||||
uint32_t end_ip = 0;
|
uint32_t end_ip = 0;
|
||||||
uint32_t range_start_ip = 0;
|
uint32_t range_start_ip = 0;
|
||||||
uint32_t range_end_ip = 0;
|
uint32_t range_end_ip = 0;
|
||||||
dhcps_lease_t *poll = opt_val;
|
dhcps_lease_t *poll = opt->val;
|
||||||
|
|
||||||
if (poll->enable) {
|
if (poll->enable) {
|
||||||
memset(&info, 0x00, sizeof(esp_netif_ip_info_t));
|
memset(&info, 0x00, sizeof(esp_netif_ip_info_t));
|
||||||
|
Reference in New Issue
Block a user