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

Support option to resolve hostname as IPv6 with esp_tls_conn_new_xxxx() (IDFGH-8458) #9920

Closed
hideakitai opened this issue Oct 6, 2022 · 2 comments
Assignees
Labels
Awaiting Response awaiting a response from the author Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF

Comments

@hideakitai
Copy link

hideakitai commented Oct 6, 2022

Is your feature request related to a problem?

esp_tls_conn_new_xxxx() cannot resolve hostname as IPv6 now. Because esp_tls_hostname_to_fd() that is called inside of it calls getaddrinfo() with fixed option: hints.ai_family = AF_UNSPEC. getaddrinfo() with AF_UNSPEC try to resolve hostname as IPv4 even when IPv4 address is not acquired (e.g. even on IPv6 only network).

static esp_err_t esp_tls_hostname_to_fd(const char *host, size_t hostlen, int port, struct sockaddr_storage *address, int* fd)
{
struct addrinfo *address_info;
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
char *use_host = strndup(host, hostlen);
if (!use_host) {
return ESP_ERR_NO_MEM;
}
ESP_LOGD(TAG, "host:%s: strlen %lu", use_host, (unsigned long)hostlen);
int res = getaddrinfo(use_host, NULL, &hints, &address_info);

Describe the solution you'd like.

Could you support an option to esp_tls_conn_new_xxxx() to set how to resolve hostname (e.g. AF_UNSPEC, AF_INET, AF_INET6, etc.) ?

Describe alternatives you've considered.

No response

Additional context.

  • IPv6 SLAAC is enabled
  • DHCPv6 is disabled
CONFIG_LWIP_IPV6=y
CONFIG_LWIP_IPV6_AUTOCONFIG=y
CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=16
@hideakitai hideakitai added the Type: Feature Request Feature request for IDF label Oct 6, 2022
@espressif-bot espressif-bot added the Status: Opened Issue is new label Oct 6, 2022
@github-actions github-actions bot changed the title Support option to resolve hostname as IPv6 with esp_tls_conn_new_xxxx() Support option to resolve hostname as IPv6 with esp_tls_conn_new_xxxx() (IDFGH-8458) Oct 6, 2022
@Harshal5
Copy link
Collaborator

Hello, @hideakitai!

Thank you for the issue report. Could you please provide the following info -

  • Target chip or module (ESP32, ESP32-S2, ESP32-S3, etc.)
  • ESP-IDF version (run git describe --tags) / commit ID
  • Example to reproduce the issue (or a minimal code snippet)
  • Debug logs
  • build sdkconfig

@espressif-bot espressif-bot added the Awaiting Response awaiting a response from the author label Oct 27, 2022
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Nov 7, 2022
@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting, will close due to short of feedback, feel free to reopen with more updates. Thanks.

@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: In Progress Work is in progress labels Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Response awaiting a response from the author Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

5 participants