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

[Proposal] Add new erl_epmd:names/2 function #2222

Closed
wants to merge 1 commit into from
Closed

[Proposal] Add new erl_epmd:names/2 function #2222

wants to merge 1 commit into from

Conversation

Gsantomaggio
Copy link

@Gsantomaggio Gsantomaggio commented Apr 30, 2019

With erl_epmd:names/2 it is possible to specify the Family address
as: net_adm:names(localhost,inet6)..
It would help to handle the nodes name resolution when the EPMD is bound
to IPV6 port:
See #602 (comment).

for example:

bin/erl -sname hello -proto_dist inet6_tcp

(hello@linux-s1)5> net_adm:names(localhost).
{error,address}

with the new function, it is possible to specify the Family address, it would be:

bin/erl -sname hello -proto_dist inet6_tcp

(hello@linux-s1)4> net_adm:names(localhost,inet6).
{ok,[{"hello",33353}]}

Note:
This is just a proposal, please let me know what you think about if it makes sense I will add the documentation.

Thank you for your attention.

With erl_epmd:names/2 it is possible to specify the Family address
as:  `net_adm:names(localhost,inet6).`.
It would help to handle the nodes name resolution when the EPMD is bound
to IPV6 port as [1].

1- #602 (comment)
@CLAassistant
Copy link

CLAassistant commented Apr 30, 2019

CLA assistant check
All committers have signed the CLA.

@KennethL KennethL added the team:VM Assigned to OTP team VM label May 6, 2019
@Gsantomaggio
Copy link
Author

I created and Vagrant image to help to test the issue.

  1. setup
vagrant up && vagrant ssh
  1. try erl
~> erl -sname hello
Protocol 'inet_tcp': register/listen error: econnrefused
  1. Try erl with inet6_tcp support
:~> sudo ss -tulpen | grep epmd
tcp    LISTEN     0      128       [::1]:4369               [::]:*                   users:(("epmd",pid=1072,fd=3),("systemd",pid=1,fd=46)) ino:15225 sk:4 v6only:1 <->

:~> erl -sname hello -proto_dist inet6_tcp
Erlang/OTP 21 [erts-10.3.3] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]
Eshell V10.3.3  (abort with ^G)
(hello@node0)1>  net_adm:names(localhost).
{error,address}

@garazdawi
Copy link
Contributor

I need to read up some more before deciding, but your approach seems to be good.

What I'm wondering is if kernel could possibly figure out this by itself, so that the user does not have to provide an argument every time it calls this function.

@garazdawi garazdawi self-assigned this May 20, 2019
@Gsantomaggio
Copy link
Author

Thank you Lukas,
I was wondering the same, I did not understand why inet_db:res_option(inet6) return false in this trace: #602 (comment) and also if there is a way to set it externally. I could not find a way.

@garazdawi
Copy link
Contributor

I did not understand why inet_db:res_option(inet6) return false in this trace: #602 (comment) and also if there is a way to set it externally. I could not find a way.

If you configure an erl_inetrc with {inet6,true}., then you will get inet_db:res_option(inet6) to return true and everything works. This will change all name resolutions to ipv6 though, not only the distribution.

vagrant@localhost:~> cat erl_inetrc
{inet6,true}.
vagrant@localhost:~> erl -kernel inetrc '"./erl_inetrc"' -sname hello -proto_dist inet6_tcp
Erlang/OTP 21 [erts-10.3.5.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe]

Eshell V10.3.5.1  (abort with ^G)
(hello@localhost)1> net_adm:names().
{ok,[{"hello",36515}]}

Does this solve your problem? It will be complicated to fix to work without setting that option and I'm not sure it actually makes sense to not set it when running ipv6 distro. Can you think of any reason why you would want to resolve ipv4 addresses per default and use ipv6 distro?

@garazdawi garazdawi added the waiting waiting for changes/input from author label Jun 4, 2019
@Gsantomaggio
Copy link
Author

It seems to work, thank you @garazdawi
If you think that this API does not need, we can close the PR.

@garazdawi
Copy link
Contributor

If you think that this API does not need, we can close the PR.

I don't know if it needed or not :) What I think would be great is to somewhere document what you need to configure in order to run erlang distribution in an ipv6 environment.

@garazdawi
Copy link
Contributor

I'll close this PR for now. If anyone thinks that it is still a good idea feel free to re-open or create a new PR.

@garazdawi garazdawi closed this Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature team:VM Assigned to OTP team VM waiting waiting for changes/input from author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants