Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gen_tcp cannot connect to IPv6 server through link-local address  #4852

@ht-hieu

Description

@ht-hieu

Describe the bug
gen_tcp get badarg when connecting to IPv6 server through link-local address. However, it can connect to a publish domain through IPv6.

To Reproduce
I have two machines, the first machine opens a TCP v6 server by using netcat.

nc -6 -l 9988

The second machine open erlang shell to connect to the opened server

1> {ok,Addr} = inet_parse:ipv6_address("fe80::2631:aee8:74dd:378d%enp0s31f6").
{ok,{65152,0,0,0,9777,44776,29917,14221}}
2> gen_tcp:connect(Addr, 9988, [binary, inet6]).
** exception exit: badarg
     in function  gen_tcp:connect/4 (gen_tcp.erl, line 167)
3>

Expected behavior
The erlang code can connect to the server and can transmit/receive data.

Affected versions
I tried Erlang 23 on Fedora 34, Erlang 21 on raspberry pi and Erlang 24 build from source.

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugstalledwaiting for input by the Erlang/OTP teamteam:PSAssigned to OTP team PS

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions