diff options
Diffstat (limited to 'lib/inets')
-rw-r--r-- | lib/inets/Makefile | 4 | ||||
-rw-r--r-- | lib/inets/doc/src/notes.xml | 14 | ||||
-rw-r--r-- | lib/inets/src/ftp/ftp.erl | 4 | ||||
-rw-r--r-- | lib/inets/src/http_lib/http_transport.erl | 64 | ||||
-rw-r--r-- | lib/inets/src/inets_app/inets.appup.src | 8 | ||||
-rw-r--r-- | lib/inets/test/inets_test_lib.erl | 9 |
6 files changed, 67 insertions, 36 deletions
diff --git a/lib/inets/Makefile b/lib/inets/Makefile index ec05efa461..f4c2746b0a 100644 --- a/lib/inets/Makefile +++ b/lib/inets/Makefile @@ -36,6 +36,8 @@ SPECIAL_TARGETS = # ---------------------------------------------------- include $(ERL_TOP)/make/otp_subdir.mk +.PHONY: info gclean + info: @echo "OS: $(OS)" @echo "DOCB: $(DOCB)" @@ -44,3 +46,5 @@ info: @echo "APP_VSN: $(APP_VSN)" @echo "" +gclean: + git clean -fXd diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml index c9972b6755..47198b1b91 100644 --- a/lib/inets/doc/src/notes.xml +++ b/lib/inets/doc/src/notes.xml @@ -51,6 +51,7 @@ </list> --> + </section> <section><title>Fixed Bugs and Malfunctions</title> @@ -66,6 +67,19 @@ <p>Own Id: OTP-9317</p> </item> + <item> + <p>[ftp] FTP client doesn't work with IPv6 host.</p> + <p>Attila Rajmund Nohl</p> + <p>Own Id: OTP-9342 Aux Id: seq11853</p> + </item> + + <item> + <p>[httpd] Peer/sockname resolv doesn't work with IPv6 addrs + in HTTP. </p> + <p>Attila Rajmund Nohl.</p> + <p>Own Id: OTP-9343</p> + </item> + </list> </section> diff --git a/lib/inets/src/ftp/ftp.erl b/lib/inets/src/ftp/ftp.erl index fe6cb0c191..ac72963347 100644 --- a/lib/inets/src/ftp/ftp.erl +++ b/lib/inets/src/ftp/ftp.erl @@ -1038,10 +1038,12 @@ handle_call({_, {open, ip_comm, Opts}}, From, State) -> Port = key_search(port, Opts, ?FTP_PORT), Timeout = key_search(timeout, Opts, ?CONNECTION_TIMEOUT), Progress = key_search(progress, Opts, ignore), + IpFamily = key_search(ipfamily, Opts, inet), State2 = State#state{client = From, mode = Mode, - progress = progress(Progress)}, + progress = progress(Progress), + ipfamily = IpFamily}, ?fcrd("handle_call(open) -> setup ctrl connection with", [{host, Host}, {port, Port}, {timeout, Timeout}]), diff --git a/lib/inets/src/http_lib/http_transport.erl b/lib/inets/src/http_lib/http_transport.erl index 01b51d531a..6c2ffc143d 100644 --- a/lib/inets/src/http_lib/http_transport.erl +++ b/lib/inets/src/http_lib/http_transport.erl @@ -500,19 +500,11 @@ close({essl, _}, Socket) -> %%------------------------------------------------------------------------- peername(ip_comm, Socket) -> case inet:peername(Socket) of - {ok,{{A, B, C, D}, Port}} -> - PeerName = integer_to_list(A)++"."++integer_to_list(B)++"."++ - integer_to_list(C)++"."++integer_to_list(D), + {ok, {Addr, Port}} when is_tuple(Addr) andalso (size(Addr) =:= 4) -> + PeerName = ipv4_name(Addr), {Port, PeerName}; - {ok,{{A, B, C, D, E, F, G, H}, Port}} -> - PeerName = http_util:integer_to_hexlist(A) ++ ":"++ - http_util:integer_to_hexlist(B) ++ ":" ++ - http_util:integer_to_hexlist(C) ++ ":" ++ - http_util:integer_to_hexlist(D) ++ ":" ++ - http_util:integer_to_hexlist(E) ++ ":" ++ - http_util:integer_to_hexlist(F) ++ ":" ++ - http_util:integer_to_hexlist(G) ++":"++ - http_util:integer_to_hexlist(H), + {ok, {Addr, Port}} when is_tuple(Addr) andalso (size(Addr) =:= 8) -> + PeerName = ipv6_name(Addr), {Port, PeerName}; {error, _} -> {-1, "unknown"} @@ -530,9 +522,11 @@ peername({essl, _}, Socket) -> peername_ssl(Socket) -> case ssl:peername(Socket) of - {ok,{{A, B, C, D}, Port}} -> - PeerName = integer_to_list(A)++"."++integer_to_list(B)++"."++ - integer_to_list(C)++"."++integer_to_list(D), + {ok, {Addr, Port}} when is_tuple(Addr) andalso (size(Addr) =:= 4) -> + PeerName = ipv4_name(Addr), + {Port, PeerName}; + {ok, {Addr, Port}} when is_tuple(Addr) andalso (size(Addr) =:= 8) -> + PeerName = ipv6_name(Addr), {Port, PeerName}; {error, _} -> {-1, "unknown"} @@ -551,19 +545,11 @@ peername_ssl(Socket) -> %%------------------------------------------------------------------------- sockname(ip_comm, Socket) -> case inet:sockname(Socket) of - {ok,{{A, B, C, D}, Port}} -> - SockName = integer_to_list(A)++"."++integer_to_list(B)++"."++ - integer_to_list(C)++"."++integer_to_list(D), + {ok, {Addr, Port}} -> + SockName = ipv4_name(Addr), {Port, SockName}; - {ok,{{A, B, C, D, E, F, G, H}, Port}} -> - SockName = http_util:integer_to_hexlist(A) ++ ":"++ - http_util:integer_to_hexlist(B) ++ ":" ++ - http_util:integer_to_hexlist(C) ++ ":" ++ - http_util:integer_to_hexlist(D) ++ ":" ++ - http_util:integer_to_hexlist(E) ++ ":" ++ - http_util:integer_to_hexlist(F) ++ ":" ++ - http_util:integer_to_hexlist(G) ++":"++ - http_util:integer_to_hexlist(H), + {ok, {Addr, Port}} -> + SockName = ipv6_name(Addr), {Port, SockName}; {error, _} -> {-1, "unknown"} @@ -581,9 +567,11 @@ sockname({essl, _}, Socket) -> sockname_ssl(Socket) -> case ssl:sockname(Socket) of - {ok,{{A, B, C, D}, Port}} -> - SockName = integer_to_list(A)++"."++integer_to_list(B)++"."++ - integer_to_list(C)++"."++integer_to_list(D), + {ok, {Addr, Port}} -> + SockName = ipv4_name(Addr), + {Port, SockName}; + {ok, {Addr, Port}} -> + SockName = ipv6_name(Addr), {Port, SockName}; {error, _} -> {-1, "unknown"} @@ -605,6 +593,22 @@ resolve() -> %%% Internal functions %%%======================================================================== +ipv4_name({A, B, C, D}) -> + integer_to_list(A) ++ "." ++ + integer_to_list(B) ++ "." ++ + integer_to_list(C) ++ "." ++ + integer_to_list(D). + +ipv6_name({A, B, C, D, E, F, G, H}) -> + http_util:integer_to_hexlist(B) ++ ":" ++ + http_util:integer_to_hexlist(C) ++ ":" ++ + http_util:integer_to_hexlist(D) ++ ":" ++ + http_util:integer_to_hexlist(E) ++ ":" ++ + http_util:integer_to_hexlist(F) ++ ":" ++ + http_util:integer_to_hexlist(G) ++ ":" ++ + http_util:integer_to_hexlist(H). + + %% Address any comes from directive: BindAddress "*" sock_opt(ip_comm, any = Addr, Opts) -> sock_opt2([{ip, Addr} | Opts]); diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src index 260a0984f2..b64e266175 100644 --- a/lib/inets/src/inets_app/inets.appup.src +++ b/lib/inets/src/inets_app/inets.appup.src @@ -20,7 +20,9 @@ [ {"5.6", [ - {load_module, httpc, soft_purge, soft_purge, []} + {load_module, httpc, soft_purge, soft_purge, []}, + {load_module, http_transport, soft_purge, soft_purge, []}, + {update, ftp, soft, soft_purge, soft_purge, []} ] }, {"5.5.2", @@ -47,7 +49,9 @@ [ {"5.6", [ - {load_module, httpc, soft_purge, soft_purge, []} + {load_module, httpc, soft_purge, soft_purge, []}, + {load_module, http_transport, soft_purge, soft_purge, []}, + {update, ftp, soft, soft_purge, soft_purge, []} ] }, {"5.5.2", diff --git a/lib/inets/test/inets_test_lib.erl b/lib/inets/test/inets_test_lib.erl index 6cedaf9638..57e5d482c9 100644 --- a/lib/inets/test/inets_test_lib.erl +++ b/lib/inets/test/inets_test_lib.erl @@ -303,7 +303,7 @@ connect_byte(ossl, Host, Port) -> connect_byte(essl, Host, Port) -> connect(ssl, Host, Port, [{ssl_imp, new}, {packet,0}]); connect_byte(ip_comm, Host, Port) -> - Opts = [inet6, {packet,0}], + Opts = [inet6, {packet, 0}], connect(ip_comm, Host, Port, Opts). @@ -327,10 +327,13 @@ connect(ip_comm, Host, Port, Opts) -> tsp("nxdomain opts: ~p", [Opts]), connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); {error, eafnosupport} -> - tsp("eafnosupport opts: ~p", [Opts]), + tsp("eafnosupport when opts: ~p", [Opts]), + connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); + {error, econnreset} -> + tsp("econnreset when opts: ~p", [Opts]), connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); {error, enetunreach} -> - tsp("eafnosupport opts: ~p", [Opts]), + tsp("eafnosupport when opts: ~p", [Opts]), connect(ip_comm, Host, Port, lists:delete(inet6, Opts)); {error, {enfile,_}} -> tsp("Error enfile"), |