@@ -1692,23 +1692,7 @@ static esp_err_t esp_netif_set_dns_info_api(esp_netif_api_msg_t *msg)
1692
1692
esp_netif_dns_type_t type = dns_param -> dns_type ;
1693
1693
esp_netif_dns_info_t * dns = dns_param -> dns_info ;
1694
1694
1695
- ESP_LOGD (TAG , "%s esp_netif:%p" , __func__ , esp_netif );
1696
-
1697
- if (esp_netif == NULL ) {
1698
- return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1699
- }
1700
-
1701
- if (!dns ) {
1702
- ESP_LOGD (TAG , "set dns null dns" );
1703
- return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1704
- }
1705
-
1706
- if (ip4_addr_isany_val (dns -> ip .u_addr .ip4 )) {
1707
- ESP_LOGD (TAG , "set dns invalid dns" );
1708
- return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1709
- }
1710
-
1711
- ESP_LOGD (TAG , "set dns if=%p type=%d dns=%x" , esp_netif , type , dns -> ip .u_addr .ip4 .addr );
1695
+ ESP_LOGD (TAG , "esp_netif_set_dns_info: if=%p type=%d dns=%x" , esp_netif , type , dns -> ip .u_addr .ip4 .addr );
1712
1696
1713
1697
ip_addr_t * lwip_ip = (ip_addr_t * )& dns -> ip ;
1714
1698
#if CONFIG_LWIP_IPV6 && LWIP_IPV4
@@ -1737,9 +1721,20 @@ static esp_err_t esp_netif_set_dns_info_api(esp_netif_api_msg_t *msg)
1737
1721
1738
1722
esp_err_t esp_netif_set_dns_info (esp_netif_t * esp_netif , esp_netif_dns_type_t type , esp_netif_dns_info_t * dns )
1739
1723
{
1740
- if (_IS_NETIF_ANY_POINT2POINT_TYPE (esp_netif )) {
1741
- return ESP_ERR_NOT_SUPPORTED ;
1724
+ if (esp_netif == NULL ) {
1725
+ return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1726
+ }
1727
+
1728
+ if (dns == NULL ) {
1729
+ ESP_LOGD (TAG , "set dns null dns" );
1730
+ return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1742
1731
}
1732
+
1733
+ if (ip4_addr_isany_val (dns -> ip .u_addr .ip4 )) {
1734
+ ESP_LOGD (TAG , "set dns invalid dns" );
1735
+ return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1736
+ }
1737
+
1743
1738
esp_netif_dns_param_t dns_param = {
1744
1739
.dns_type = type ,
1745
1740
.dns_info = dns
@@ -1754,18 +1749,14 @@ static esp_err_t esp_netif_get_dns_info_api(esp_netif_api_msg_t *msg)
1754
1749
esp_netif_dns_type_t type = dns_param -> dns_type ;
1755
1750
esp_netif_dns_info_t * dns = dns_param -> dns_info ;
1756
1751
1757
- ESP_LOGD (TAG , "%s esp_netif:%p" , __func__ , esp_netif );
1758
-
1759
- if (!dns ) {
1760
- ESP_LOGE (TAG , "%s: dns_info cannot be NULL" , __func__ );
1761
- return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1762
- }
1752
+ ESP_LOGD (TAG , "esp_netif_get_dns_info: esp_netif=%p type=%d" , esp_netif , type );
1763
1753
1764
1754
if (esp_netif -> flags & ESP_NETIF_DHCP_SERVER ) {
1765
1755
#if ESP_DHCPS
1766
1756
ip4_addr_t dns_ip ;
1767
1757
dhcps_dns_getserver (esp_netif -> dhcps , & dns_ip );
1768
1758
memcpy (& dns -> ip .u_addr .ip4 , & dns_ip , sizeof (ip4_addr_t ));
1759
+ dns -> ip .type = ESP_IPADDR_TYPE_V4 ;
1769
1760
#else
1770
1761
LOG_NETIF_DISABLED_AND_DO ("DHCP Server" , return ESP_ERR_NOT_SUPPORTED );
1771
1762
#endif
@@ -1782,17 +1773,13 @@ static esp_err_t esp_netif_get_dns_info_api(esp_netif_api_msg_t *msg)
1782
1773
1783
1774
esp_err_t esp_netif_get_dns_info (esp_netif_t * esp_netif , esp_netif_dns_type_t type , esp_netif_dns_info_t * dns )
1784
1775
{
1785
- if (_IS_NETIF_ANY_POINT2POINT_TYPE (esp_netif )) {
1786
- const ip_addr_t * dns_ip = dns_getserver (type );
1787
- if (dns_ip == IP_ADDR_ANY ) {
1788
- return ESP_ERR_ESP_NETIF_DNS_NOT_CONFIGURED ;
1789
- }
1790
- #if CONFIG_LWIP_IPV6
1791
- memcpy (& dns -> ip .u_addr .ip4 , & dns_ip -> u_addr .ip4 , sizeof (ip4_addr_t ));
1792
- #else
1793
- memcpy (& dns -> ip .u_addr .ip4 , & dns_ip -> addr , sizeof (ip4_addr_t ));
1794
- #endif
1795
- return ESP_OK ;
1776
+ if (esp_netif == NULL ) {
1777
+ return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1778
+ }
1779
+
1780
+ if (dns == NULL ) {
1781
+ ESP_LOGE (TAG , "%s: dns_info cannot be NULL" , __func__ );
1782
+ return ESP_ERR_ESP_NETIF_INVALID_PARAMS ;
1796
1783
}
1797
1784
1798
1785
esp_netif_dns_param_t dns_param = {
0 commit comments