Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dns: fix init with only IPv4 enabled (IDFGH-11392) #62

Closed

Conversation

cbaechler
Copy link
Contributor

When defining FALLBACK_DNS_SERVER_ADDRESS in a project where only LWIP_IPV4 is enabled, compiling dns_init will result in a compilation error:

esp-idf/components/lwip/lwip/src/core/dns.c: In function 'dns_init':
esp-idf/components/lwip/lwip/src/core/dns.c:328:12: error: 'ip_addr_t' {aka 'struct ip4_addr'} has no member named 'type'
   dnsserver.type = IPADDR_TYPE_V4;

This is due to the fact that ip_addr_t is defined as

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;

only if IPv4 and IPv6 support are enabled at the same time.

In the case where only IPv4 support is enabled, the definition of ip_addr_t is

struct ip4_addr {
  u32_t addr;
};

typedef struct ip4_addr ip4_addr_t;

typedef ip4_addr_t ip_addr_t;

which lacks the type field.

This PR aims to fix this and make it compile for our scenario.

@KonssnoK
Copy link

KonssnoK commented Nov 6, 2023

thanks @cbaechler

@github-actions github-actions bot changed the title dns: fix init with only IPv4 enabled dns: fix init with only IPv4 enabled (IDFGH-11392) Nov 6, 2023
Copy link
Collaborator

@david-cermak david-cermak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this issue!

@david-cermak
Copy link
Collaborator

cherry-picked as 5aab73d to 2.1.3-esp and 1de11ef to 2.1.2-esp.

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants