diff options
author | Ingela Anderton Andin <[email protected]> | 2016-03-01 14:06:20 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2016-03-01 14:06:20 +0100 |
commit | 75bc5bebc070a59535b8f6b7b9085c210b4723b5 (patch) | |
tree | 8868096be6ad2eadce99475293f370008df1aa9f /lib/kernel/src | |
parent | 6f8997c001a17b9d9322e26757690489d6111dac (diff) | |
parent | 40695d080b0dc0665b01803768ffc74ed2eca207 (diff) | |
download | otp-75bc5bebc070a59535b8f6b7b9085c210b4723b5.tar.gz otp-75bc5bebc070a59535b8f6b7b9085c210b4723b5.tar.bz2 otp-75bc5bebc070a59535b8f6b7b9085c210b4723b5.zip |
Merge branch 'msantos/epmd-IPv6-node-reg2/PR-864/OTP-13364' into maint
* msantos/epmd-IPv6-node-reg2/PR-864/OTP-13364:
epmd: support IPv6 node registration
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/erl_epmd.erl | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/kernel/src/erl_epmd.erl b/lib/kernel/src/erl_epmd.erl index 55ce9a7e64..c6202dd796 100644 --- a/lib/kernel/src/erl_epmd.erl +++ b/lib/kernel/src/erl_epmd.erl @@ -32,7 +32,7 @@ %% External exports -export([start/0, start_link/0, stop/0, port_please/2, port_please/3, names/0, names/1, - register_node/2, open/0, open/1, open/2]). + register_node/2, register_node/3, open/0, open/1, open/2]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, handle_info/2, @@ -102,7 +102,9 @@ names(EpmdAddr) -> register_node(Name, PortNo) -> - gen_server:call(erl_epmd, {register, Name, PortNo}, infinity). + register_node(Name, PortNo, inet). +register_node(Name, PortNo, Family) -> + gen_server:call(erl_epmd, {register, Name, PortNo, Family}, infinity). %%%---------------------------------------------------------------------- %%% Callback functions from gen_server @@ -120,10 +122,10 @@ init(_) -> -spec handle_call(calls(), term(), state()) -> {'reply', term(), state()} | {'stop', 'shutdown', 'ok', state()}. -handle_call({register, Name, PortNo}, _From, State) -> +handle_call({register, Name, PortNo, Family}, _From, State) -> case State#state.socket of P when P < 0 -> - case do_register_node(Name, PortNo) of + case do_register_node(Name, PortNo, Family) of {alive, Socket, Creation} -> S = State#state{socket = Socket, port_no = PortNo, @@ -206,8 +208,12 @@ open({A,B,C,D,E,F,G,H}=EpmdAddr, Timeout) when ?ip6(A,B,C,D,E,F,G,H) -> close(Socket) -> gen_tcp:close(Socket). -do_register_node(NodeName, TcpPort) -> - case open() of +do_register_node(NodeName, TcpPort, Family) -> + Localhost = case Family of + inet -> open({127,0,0,1}); + inet6 -> open({0,0,0,0,0,0,0,1}) + end, + case Localhost of {ok, Socket} -> Name = to_string(NodeName), Extra = "", |