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

Conf option to have an end to end ipv6 otp release #602

Open
wants to merge 1 commit into
base: maint
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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