From 0434173fdca9f4159b340aef4796d30f34b076f9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Wed, 29 May 2019 13:58:52 +0200 Subject: [esock|test] Ensure only "real" IPv6 address'es are accepted When geting the local address, make sure we don't accept the loopback address. --- erts/emulator/test/socket_SUITE.erl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'erts') diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl index 0ec097836b..d8cb1013e9 100644 --- a/erts/emulator/test/socket_SUITE.erl +++ b/erts/emulator/test/socket_SUITE.erl @@ -24057,9 +24057,13 @@ which_addr(Domain, [_|IFL]) -> which_addr2(_Domain, []) -> {error, no_address}; -which_addr2(inet = _Domain, [{addr, Addr}|_IFO]) when (size(Addr) =:= 4) -> +which_addr2(inet = _Domain, [{addr, Addr}|_IFO]) + when (size(Addr) =:= 4) andalso (element(1, Addr) =/= 127) -> {ok, Addr}; -which_addr2(inet6 = _Domain, [{addr, Addr}|_IFO]) when (size(Addr) =:= 8) -> +which_addr2(inet6 = _Domain, [{addr, Addr}|_IFO]) + when (size(Addr) =:= 8) andalso + (element(1, Addr) =/= 0) andalso + (element(1, Addr) =/= 16#fe80) -> {ok, Addr}; which_addr2(Domain, [_|IFO]) -> which_addr2(Domain, IFO). -- cgit v1.2.3