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

failed to listen on the port 6969 with ipv6 #38

Open
maswan opened this issue Jul 14, 2021 · 1 comment
Open

failed to listen on the port 6969 with ipv6 #38

maswan opened this issue Jul 14, 2021 · 1 comment

Comments

@maswan
Copy link

maswan commented Jul 14, 2021

When running hefurd on a new host with -ipv6 I get the error message: "hefur: fatal: failed to listen on the port 6969: Cannot assign requested address". Other processes don't have any problems listening to the port, for example nc -6 -l -p 6969 (when hefurd isn't running).

OS: Ubuntu 20.04, amd64. Hefur as from git today.

@zao
Copy link

zao commented Sep 20, 2021

If invoked as hefurd -ipv6 it will fail because the code invokes inet_pton with AF_INET6 but the default value for the command line option -bind-addr is "0.0.0.0".

inet_pton(ipv6 ? AF_INET6 : AF_INET, BIND_ADDR.c_str(), buf);

According to man pages inet_pton docs the function when in AF_INET6 mode explicitly only handles addresses in IPv6 format, documenting in the BUGS section that dotted octet notation needs to be IPv4-mapped in IPv6 format.

AF_INET6 does not recognize IPv4 addresses. An explicit IPv4-mapped IPv6 address must be supplied in src instead.

A workaround is to specify -bind-addr :: when launching the daemon. As for why/how this behaviour has changed, my guess would be library improvements.

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