diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 40c5a515f..975f79423 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -243,8 +243,8 @@ init([{SockMod, Socket}, Opts, FSMLimitOpts]) -> %% Check if IP is blacklisted: case is_ip_blacklisted(IP) of true -> - ?INFO_MSG("Connection attempt from blacklisted IP: ~s", - [jlib:ip_to_list(IP)]), + ?INFO_MSG("Connection attempt from blacklisted IP: ~s (~w)", + [jlib:ip_to_list(IP), IP]), {stop, normal}; false -> Socket1 = diff --git a/src/jlib.erl b/src/jlib.erl index 930434e83..fad376684 100644 --- a/src/jlib.erl +++ b/src/jlib.erl @@ -387,8 +387,8 @@ e(X) -> exit({bad_encode_base64_token, X}). %% Convert Erlang inet IP to list ip_to_list({IP, _Port}) -> ip_to_list(IP); -ip_to_list({A,B,C,D}) -> - lists:flatten(io_lib:format("~w.~w.~w.~w",[A,B,C,D])). +ip_to_list(IpTuple) when is_tuple(IpTuple) -> + inet_parse:ntoa(IpTuple). % -------------------------------------------------------------------- % Compat layer.