getting incompatible error types when assigning

kesha.modhia
Posts: 41
Joined: Fri May 13, 2022 12:36 pm

getting incompatible error types when assigning

Postby kesha.modhia » Thu May 26, 2022 5:14 am

getting error of incompatible types assigning to the variable


bool ethernet_get_ip (tcpip_adapter_ip_info_t *ip,ip_addr_t *dns)
{
bool ret = false;
if (ip == NULL) {
DEBUG_LOGE(UART, TAG, "Invalid Parameter");
} else {
if (tcpip_adapter_get_ip_info(ESP_IF_ETH, ip) == 0) {
if (dns != NULL) {
#ifdef CONFIG_CPU_ESP32
*dns = dns_getserver(0);
#else
*dns = (ip_addr_t *)dns_getserver(0);
#endif
}
ret = true;
} else {
DEBUG_LOGE(UART, TAG,
"tcpip_adapter_set_ip_info failed," " invalid parameters");
}
}
return ret;
}

---------------------------------------------------------------
here below is the structure defined for your reference
---------------------------------------------------------------

typedef struct ip_addr {
union {
ip6_addr_t ip6;
ip4_addr_t ip4;
} u_addr;
/** @ref lwip_ip_addr_type */
u8_t type;
} ip_addr_t;


---------------------------------------------------------------
here below is the API that is being called
---------------------------------------------------------------

const ip_addr_t *dns_getserver(u8_t numdns)
{
if (numdns < DNS_MAX_SERVERS) {
return &dns_servers[numdns];
} else {
return IP_ADDR_ANY;
}
}

---------------------------------------------------------------
here below error receiving while compilation
---------------------------------------------------------------

error: incompatible types when assigning to type 'ip_addr_t' {aka 'struct ip_addr'} from type 'const ip_addr_t *' {aka 'const st
ruct ip_addr *'}
*dns = dns_getserver(0);

Who is online

Users browsing this forum: Google [Bot] and 120 guests