aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-04-14 06:16:22 +0000
committerErlang/OTP <[email protected]>2010-04-14 06:16:22 +0000
commit1aa3a061cfa397acba8afd4eb9a3765b4292156c (patch)
treecb6b82add3a4a65204a81c318000124ca9e438c3
parente313bb4982f50ab15687d5063be7bfa2a6c4f76c (diff)
parent89a89441d0dab3e451fcadec5f2151b4d5ca794f (diff)
downloadotp-1aa3a061cfa397acba8afd4eb9a3765b4292156c.tar.gz
otp-1aa3a061cfa397acba8afd4eb9a3765b4292156c.tar.bz2
otp-1aa3a061cfa397acba8afd4eb9a3765b4292156c.zip
Merge branch 'jb/inet6-dist' into dev
* jb/inet6-dist: Support IPv6 addresses in long host names Fix implementation of IPv6 TCP distribution protocol Fix compilation of epmd with IPv6 enabled OTP-8575 jb/inet6-dist
-rw-r--r--erts/epmd/src/epmd_int.h12
-rw-r--r--lib/kernel/src/inet6_tcp_dist.erl35
2 files changed, 22 insertions, 25 deletions
diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h
index 65fcf9bacb..0e432e2cb0 100644
--- a/erts/epmd/src/epmd_int.h
+++ b/erts/epmd/src/epmd_int.h
@@ -192,26 +192,18 @@
#define FAMILY AF_INET6
#define SET_ADDR_LOOPBACK(addr, af, port) do { \
- static u_int32_t __addr[4] = IN6ADDR_LOOPBACK_INIT; \
memset((char*)&(addr), 0, sizeof(addr)); \
(addr).sin6_family = (af); \
(addr).sin6_flowinfo = 0; \
- (addr).sin6_addr.s6_addr32[0] = __addr[0]; \
- (addr).sin6_addr.s6_addr32[1] = __addr[1]; \
- (addr).sin6_addr.s6_addr32[2] = __addr[2]; \
- (addr).sin6_addr.s6_addr32[3] = __addr[3]; \
+ (addr).sin6_addr = in6addr_loopback; \
(addr).sin6_port = htons(port); \
} while(0)
#define SET_ADDR_ANY(addr, af, port) do { \
- static u_int32_t __addr[4] = IN6ADDR_ANY_INIT; \
memset((char*)&(addr), 0, sizeof(addr)); \
(addr).sin6_family = (af); \
(addr).sin6_flowinfo = 0; \
- (addr).sin6_addr.s6_addr32[0] = __addr[0]; \
- (addr).sin6_addr.s6_addr32[1] = __addr[1]; \
- (addr).sin6_addr.s6_addr32[2] = __addr[2]; \
- (addr).sin6_addr.s6_addr32[3] = __addr[3]; \
+ (addr).sin6_addr = in6addr_any; \
(addr).sin6_port = htons(port); \
} while(0)
diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl
index 34cf582af7..fab00bbb9f 100644
--- a/lib/kernel/src/inet6_tcp_dist.erl
+++ b/lib/kernel/src/inet6_tcp_dist.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(inet6_tcp_dist).
@@ -87,7 +87,7 @@ accept(Listen) ->
accept_loop(Kernel, Listen) ->
case inet6_tcp:accept(Listen) of
{ok, Socket} ->
- Kernel ! {accept,self(),Socket,inet,tcp},
+ Kernel ! {accept,self(),Socket,inet6,tcp},
controller(Kernel, Socket),
accept_loop(Kernel, Listen);
Error ->
@@ -236,8 +236,8 @@ do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) ->
timer = Timer,
this_flags = 0,
other_version = Version,
- f_send = fun inet_tcp:send/2,
- f_recv = fun inet_tcp:recv/3,
+ f_send = fun inet6_tcp:send/2,
+ f_recv = fun inet6_tcp:recv/3,
f_setopts_pre_nodeup =
fun(S) ->
inet:setopts
@@ -262,7 +262,7 @@ do_setup(Kernel, Node, Type, MyNode, LongOrShortNames,SetupTime) ->
address = {Ip,TcpPort},
host = Address,
protocol = tcp,
- family = inet}
+ family = inet6}
end,
mf_tick = fun ?MODULE:tick/1,
mf_getstat = fun ?MODULE:getstat/1,
@@ -302,12 +302,17 @@ splitnode(Node, LongOrShortNames) ->
Host = lists:append(Tail),
case split_node(Host, $., []) of
[_] when LongOrShortNames =:= longnames ->
- error_msg("** System running to use "
- "fully qualified "
- "hostnames **~n"
- "** Hostname ~s is illegal **~n",
- [Host]),
- ?shutdown(Node);
+ case inet_parse:ipv6strict_address(Host) of
+ {ok, _} ->
+ [Name, Host];
+ _ ->
+ error_msg("** System running to use "
+ "fully qualified "
+ "hostnames **~n"
+ "** Hostname ~s is illegal **~n",
+ [Host]),
+ ?shutdown(Node)
+ end;
L when length(L) > 1, LongOrShortNames =:= shortnames ->
error_msg("** System NOT running to use fully qualified "
"hostnames **~n"