Skip to content

Commit

Permalink
Conf option to have an end to end ipv6 otp release
Browse files Browse the repository at this point in the history
 - add support for ipv6 connections to Epmd (removed from PR because
   added into commit 75bc5be with the merge of PR-864/OTP-13364)
 - add a macro to define the default epmd ip: "::1" or "127.0.0.1"
 - add a macro to define the default proto_dist: inet_tcp or inet6_tcp
 - add a configure option to compile the whole otp in ipv6 default mode

The option --enable-epmd-ipv6 configures:

- the -DEPMD6 CFLAG for epmd compilation
- the default proto_dist (without init arg) to "inet6_tcp"
- the epmd connection ip to "::1"
  • Loading branch information
awetzel committed Mar 2, 2016
1 parent e1489c4 commit f53fc31
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
11 changes: 11 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ AC_ARG_ENABLE(native-libs,
AS_HELP_STRING([--enable-native-libs],
[compile Erlang libraries to native code]))

AC_ARG_ENABLE(epmd-ipv6,
AS_HELP_STRING([--enable-epmd-ipv6],
[enable epmd ipv6 communication instead of ipv4]))

AC_ARG_WITH(dynamic-trace,
AS_HELP_STRING([--with-dynamic-trace={dtrace|systemtap}],
[specify use of dynamic trace framework, dtrace or systemtap])
Expand Down Expand Up @@ -420,6 +424,13 @@ if test X${enable_native_libs} = Xyes -a X${enable_hipe} != Xno; then
fi
AC_SUBST(NATIVE_LIBS_ENABLED)

EPMD_IPV6_ENABLED=
if test X${enable_epmd_ipv6} = Xyes; then
CFLAGS="-DEPMD6 $CFLAGS"
export CFLAGS
EPMD_IPV6_ENABLED=yes
fi
AC_SUBST(EPMD_IPV6_ENABLED)

rm -f $ERL_TOP/lib/SKIP-APPLICATIONS
for app in `cd lib && ls -d *`; do
Expand Down
12 changes: 12 additions & 0 deletions erts/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ AC_ARG_ENABLE(native-libs,
AS_HELP_STRING([--enable-native-libs],
[compile Erlang libraries to native code]))

AC_ARG_ENABLE(epmd-ipv6,
AS_HELP_STRING([--enable-epmd-ipv6],
[enable epmd ipv6 communication instead of ipv4]))

AC_ARG_ENABLE(fp-exceptions,
AS_HELP_STRING([--enable-fp-exceptions],
[use hardware floating point exceptions (default if hipe enabled)]),
Expand Down Expand Up @@ -3516,6 +3520,14 @@ if test X${enable_native_libs} = Xyes -a X${HIPE_ENABLED} = Xyes; then
fi
AC_SUBST(NATIVE_LIBS_ENABLED)

EPMD_IPV6_ENABLED=
if test X${enable_epmd_ipv6} = Xyes; then
CFLAGS="-DEPMD6 $CFLAGS"
export CFLAGS
EPMD_IPV6_ENABLED=yes
fi
AC_SUBST(EPMD_IPV6_ENABLED)

#
# Check for working poll().
#
Expand Down
8 changes: 7 additions & 1 deletion lib/kernel/src/erl_epmd.erl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
-define(port_please_failure2(Term), noop).
-endif.

-ifdef(EPMD_IPV6).
-define(DEFAULT_EPMD_IP, {0,0,0,0,0,0,0,1}).
-else.
-define(DEFAULT_EPMD_IP, {127,0,0,1}).
-endif.

%% External exports
-export([start/0, start_link/0, stop/0, port_please/2,
port_please/3, names/0, names/1,
Expand Down Expand Up @@ -193,7 +199,7 @@ get_epmd_port() ->
%%
%% Epmd socket
%%
open() -> open({127,0,0,1}). % The localhost IP address.
open() -> open(?DEFAULT_EPMD_IP). % The localhost IP address.

open({A,B,C,D}=EpmdAddr) when ?ip(A,B,C,D) ->
gen_tcp:connect(EpmdAddr, get_epmd_port(), [inet]);
Expand Down
10 changes: 8 additions & 2 deletions lib/kernel/src/net_kernel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
-define(tckr_dbg(X), ok).
-endif.

-ifdef(EPMD_IPV6).
-define(DEFAULT_PROTO_DIST, "inet6_tcp").
-else.
-define(DEFAULT_PROTO_DIST, "inet_tcp").
-endif.

%% User Interface Exports
-export([start/1, start_link/1, stop/0,
kernel_apply/3,
Expand Down Expand Up @@ -1276,7 +1282,7 @@ protocol_childspecs() ->
{ok, [Protos]} ->
protocol_childspecs(Protos);
_ ->
protocol_childspecs(["inet_tcp"])
protocol_childspecs([?DEFAULT_PROTO_DIST])
end.

protocol_childspecs([]) ->
Expand Down Expand Up @@ -1312,7 +1318,7 @@ start_protos(Name,Node) ->
{ok, [Protos]} ->
start_protos(Name,Protos, Node);
_ ->
start_protos(Name,["inet_tcp"], Node)
start_protos(Name,[?DEFAULT_PROTO_DIST], Node)
end.

start_protos(Name,Ps, Node) ->
Expand Down
11 changes: 11 additions & 0 deletions make/otp.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ DUBIOUS_ORIGINS = /undefined/environment/
HIPE_ENABLED=@HIPE_ENABLED@
NATIVE_LIBS_ENABLED=@NATIVE_LIBS_ENABLED@

# ----------------------------------------------------
# Epmd default IPV6
# ----------------------------------------------------

EPMD_IPV6_ENABLED=@EPMD_IPV6_ENABLED@

# ----------------------------------------------------
# Command macros
# ----------------------------------------------------
Expand Down Expand Up @@ -99,6 +105,11 @@ else
ERL_COMPILE_FLAGS += +debug_info
endif
endif

ifeq ($(EPMD_IPV6_ENABLED),yes)
ERL_COMPILE_FLAGS += -DEPMD_IPV6
endif

ERLC_WFLAGS = -W
ERLC = erlc $(ERLC_WFLAGS) $(ERLC_FLAGS)
ERL = erl -boot start_clean
Expand Down

0 comments on commit f53fc31

Please sign in to comment.