aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src/inet.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2015-12-03 11:11:00 +0100
committerErlang/OTP <[email protected]>2015-12-03 11:11:00 +0100
commitdf7c7b59c9f1b796e72d1d27a35a61f1392d7f23 (patch)
tree5acb1151ef55f60f4759b313c83bc3a097c2cb37 /lib/kernel/src/inet.erl
parentbd1251dfe4d60f09e569731d36a92e94acbe297a (diff)
parent54204bb039a780e7b8d9295303bf7a4f41744641 (diff)
downloadotp-df7c7b59c9f1b796e72d1d27a35a61f1392d7f23.tar.gz
otp-df7c7b59c9f1b796e72d1d27a35a61f1392d7f23.tar.bz2
otp-df7c7b59c9f1b796e72d1d27a35a61f1392d7f23.zip
Merge branch 'raimo/inet-setopts-multi-raw/OTP-11482' into maint-17
* raimo/inet-setopts-multi-raw/OTP-11482: Update appup Testcase for inet:setopts/2 multiple raw options Fix inet:setopts/2 to take multiple raw options Fix error propagate from setopts
Diffstat (limited to 'lib/kernel/src/inet.erl')
-rw-r--r--lib/kernel/src/inet.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/kernel/src/inet.erl b/lib/kernel/src/inet.erl
index ec2c350931..9211134c75 100644
--- a/lib/kernel/src/inet.erl
+++ b/lib/kernel/src/inet.erl
@@ -690,6 +690,7 @@ connect_options(Opts, Family) ->
case con_opt(Opts, BaseOpts, connect_options()) of
{ok, R} ->
{ok, R#connect_opts {
+ opts = lists:reverse(R#connect_opts.opts),
ifaddr = translate_ip(R#connect_opts.ifaddr, Family)
}};
Error -> Error
@@ -758,6 +759,7 @@ listen_options(Opts, Family) ->
case list_opt(Opts, BaseOpts, listen_options()) of
{ok, R} ->
{ok, R#listen_opts {
+ opts = lists:reverse(R#listen_opts.opts),
ifaddr = translate_ip(R#listen_opts.ifaddr, Family)
}};
Error -> Error
@@ -816,6 +818,7 @@ udp_options(Opts, Family) ->
case udp_opt(Opts, #udp_opts { }, udp_options()) of
{ok, R} ->
{ok, R#udp_opts {
+ opts = lists:reverse(R#udp_opts.opts),
ifaddr = translate_ip(R#udp_opts.ifaddr, Family)
}};
Error -> Error
@@ -889,9 +892,12 @@ sctp_options() ->
sctp_options(Opts, Mod) ->
case sctp_opt(Opts, Mod, #sctp_opts{}, sctp_options()) of
{ok,#sctp_opts{ifaddr=undefined}=SO} ->
- {ok,SO#sctp_opts{ifaddr=Mod:translate_ip(?SCTP_DEF_IFADDR)}};
- {ok,_}=OK ->
- OK;
+ {ok,
+ SO#sctp_opts{
+ opts=lists:reverse(SO#sctp_opts.opts),
+ ifaddr=Mod:translate_ip(?SCTP_DEF_IFADDR)}};
+ {ok,SO} ->
+ {ok,SO#sctp_opts{opts=lists:reverse(SO#sctp_opts.opts)}};
Error -> Error
end.
@@ -963,6 +969,8 @@ add_opt(Name, Val, Opts, As) ->
case lists:member(Name, As) of
true ->
case prim_inet:is_sockopt_val(Name, Val) of
+ true when Name =:= raw ->
+ {ok, [{Name,Val} | Opts]};
true ->
Opts1 = lists:keydelete(Name, 1, Opts),
{ok, [{Name,Val} | Opts1]};