aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src
diff options
context:
space:
mode:
authorTomas Abrahamsson <[email protected]>2012-05-10 18:52:18 +0200
committerTomas Abrahamsson <[email protected]>2012-08-16 01:48:04 +0200
commit87570500f821c4aaeafa18705b3a4a479f5d9baa (patch)
treea25688373f742d13a62ba4f52127073739cbcb17 /erts/preloaded/src
parent2e3852b6942d4bf4eab909b501b7085d5ccd0e68 (diff)
downloadotp-87570500f821c4aaeafa18705b3a4a479f5d9baa.tar.gz
otp-87570500f821c4aaeafa18705b3a4a479f5d9baa.tar.bz2
otp-87570500f821c4aaeafa18705b3a4a479f5d9baa.zip
Allow mixed IPv4 and IPv6 addresses to sctp_bindx
Also allow mixed address families to bind, since the first address on a multihomed sctp socket must be bound with bind, while the rest are to be bound using sctp_bindx. At least Linux supports adding address of mixing families. Make inet_set_faddress function available also when HAVE_SCTP is not defined, since we use it to find an address for bind to be able to mix ipv4 and ipv6 addresses.
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r--erts/preloaded/src/prim_inet.erl6
1 files changed, 3 insertions, 3 deletions
diff --git a/erts/preloaded/src/prim_inet.erl b/erts/preloaded/src/prim_inet.erl
index 846ae97ed2..91fcd3ac82 100644
--- a/erts/preloaded/src/prim_inet.erl
+++ b/erts/preloaded/src/prim_inet.erl
@@ -184,7 +184,7 @@ close_pend_loop(S, N) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bind(S,IP,Port) when is_port(S), is_integer(Port), Port >= 0, Port =< 65535 ->
- case ctl_cmd(S,?INET_REQ_BIND,[?int16(Port),ip_to_bytes(IP)]) of
+ case ctl_cmd(S,?INET_REQ_BIND,enc_value(set, addr, {IP,Port})) of
{ok, [P1,P0]} -> {ok, ?u16(P1, P0)};
{error,_}=Error -> Error
end;
@@ -206,10 +206,10 @@ bindx(S, AddFlag, Addrs) ->
case getprotocol(S) of
sctp ->
%% Really multi-homed "bindx". Stringified args:
- %% [AddFlag, (Port, IP)+]:
+ %% [AddFlag, (AddrBytes see enc_value_2(addr,X))+]:
Args =
[?int8(AddFlag)|
- [[?int16(Port)|ip_to_bytes(IP)] ||
+ [enc_value(set, addr, {IP,Port}) ||
{IP, Port} <- Addrs]],
case ctl_cmd(S, ?SCTP_REQ_BINDX, Args) of
{ok,_} -> {ok, S};