8000 ipv6 getaddrinfo error · Issue #3286 · warmcat/libwebsockets · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ipv6 getaddrinfo error #3286

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

Open
changdingfang opened this issue Nov 26, 2024 · 9 comments
Open

ipv6 getaddrinfo error #3286

changdingfang opened this issue Nov 26, 2024 · 9 comments

Comments

@changdingfang
Copy link

error log: "lws_getaddrinfo46: getaddrinfo 'ipv6 address' says 7"
error log: lws_client_connect_3_connect: dns lookup failed 7

In the lws_client_connect_2_dnsreq interface, an error is reported when the getaddrinfo command is executed for the IPv6 address in square brackets. As a result, the link cannot be set up.

Android machine

@lws-team
Copy link
Member

So... this works OK without the square brackets?

@changdingfang
Copy link
Author

yes

@changdingfang
Copy link
Author

When the lws_client_connect_via_info interface is invoked, the addr field of lws_client_connect_info does not contain square brackets. As a result, the HTTP part fails.

@lws-team
Copy link
Member

It sounds like some code is needed to strip the square brackets if present before using it with things that don't know about it.

@changdingfang
Copy link
Author

Yes, the square brackets are used to isolate IPv6 addresses and ports, but some interfaces cannot recognize the square brackets and need to be removed separately.

@changdingfang
Copy link
Author

Can this problem be handled in later versions?

@lws-team
Copy link
Member
lws-team commented Mar 1, 2025

It seems the basic point is that this square bracket syntax only exists to disambiguate urls (literally, urls) which already have another meaning for : to separate the port. So for example https://::1:443 which is ambiguous, would be https://[::1]:443 which only has one interpretation. See https://en.wikipedia.org/wiki/IPv6_address#Literal_IPv6_addresses_in_network_resource_identifiers

As such, if I understand it, it's not an "ipv6 thing" that should make it into the ipv6 layer, it's a 'url thing' and it should be stripped when parsing the host IP or name from the url representation; the parsed host part should have been delimited by any [] but should no longer contain them. Otherwise the general ipv6 stuff doesn't need to see or handle [] AIUI. In other words, it seems a problem for user code.

lws_parse_uri() which is the api for separating uri pieces (including hostname) already understands [] in the incoming url as delimiting the host ip or name and should remove them if present in the output.

lws_parse_uri(char *p, const char **prot, const char **ads, int *port,

So AFAICS there's nothing to do in lws about this?

@changdingfang
Copy link
Author

What is the network address of the parameter transferred by the lws_client_connect_via_info interface?
If there are no square brackets, the libwebsocket library cannot identify the IPv6 address.
If the content contains square brackets, the libwebsocket library intercepts the content and identifies it as a URL.
I understand that this is a problem that the libwebsocket library is not properly adapted.

@lws-team
Copy link
Member

I understand that this is a problem that the libwebsocket library is not properly adapted.

Well, it's quite possible, since I mostly wrote the whole thing over 15 years alone, unpaid. But in this case, I think you don't understand the problem yet.

Are you using lws_parse_url()? As I wrote above your comment, [] is not an ipv6 thing, it is a URL thing. The api for dealing with it in lws lives in the URL handling api.

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

No branches or pull requests

2 participants
0