aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn-Mark Bell <[email protected]>2010-03-23 12:10:00 +0000
committerBjörn Gustavsson <[email protected]>2010-04-13 13:51:52 +0200
commit89a89441d0dab3e451fcadec5f2151b4d5ca794f (patch)
tree2dbcbf20125eded6e513c7903acde5c224abae72
parent3c1f8435a9032667e207d92d21777612e15e6528 (diff)
downloadotp-89a89441d0dab3e451fcadec5f2151b4d5ca794f.tar.gz
otp-89a89441d0dab3e451fcadec5f2151b4d5ca794f.tar.bz2
otp-89a89441d0dab3e451fcadec5f2151b4d5ca794f.zip
Support IPv6 addresses in long host names
When distributing over IPv4, node@<IPv4-address> (e.g. [email protected]) works correctly. Permit node@<IPv6-address> (e.g. node@::1) when distributing over IPv6.
-rw-r--r--lib/kernel/src/inet6_tcp_dist.erl17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/kernel/src/inet6_tcp_dist.erl b/lib/kernel/src/inet6_tcp_dist.erl
index 097cadf8d4..9faee74eda 100644
--- a/lib/kernel/src/inet6_tcp_dist.erl
+++ b/lib/kernel/src/inet6_tcp_dist.erl
@@ -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"