diff options
author | Anders Svensson <[email protected]> | 2017-03-30 16:29:02 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-06-11 16:30:35 +0200 |
commit | 1df74351286b6cd0e2b673fdf07f7219244ce9a7 (patch) | |
tree | b3c82af8c828656260d097f9ae3304e7be653733 /lib/diameter/test/diameter_examples_SUITE.erl | |
parent | 111261d15df900bedd544ba1fab3a5880abda70a (diff) | |
download | otp-1df74351286b6cd0e2b673fdf07f7219244ce9a7.tar.gz otp-1df74351286b6cd0e2b673fdf07f7219244ce9a7.tar.bz2 otp-1df74351286b6cd0e2b673fdf07f7219244ce9a7.zip |
Work around SCTP quirks on sparc-sun-solaris2.10
This addresses the testcase failures mentioned in the parent commit,
which has been on account of the behaviour below, in which connect fails
on the loopback address. Work around it by finding/using another address
if possible.
$ erl
Erlang/OTP 20 [DEVELOPMENT] [erts-9.0] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false] [sharing-preserving]
Eshell V9.0 (abort with ^G)
1> {ok, LP} = gen_sctp:open().
{ok,#Port<0.439>}
2> gen_sctp:listen(LP, true).
ok
3> inet:socknames(LP).
{ok,[{{10,67,16,178},36506},{{127,0,0,1},36506}]}
4> {ok, S} = gen_sctp:open([{ip, {127,0,0,1}}]).
{ok,#Port<0.443>}
5> gen_sctp:connect_init(S, {127,0,0,1}, 36506, []).
{error,eaddrnotavail}
6> gen_sctp:connect_init(S, {10,67,16,178}, 36506, []).
{error,eaddrnotavail}
7> gen_sctp:close(S).
ok
8> f(S).
ok
9> {ok, S} = gen_sctp:open().
{ok,#Port<0.444>}
10> gen_sctp:connect_init(S, {127,0,0,1}, 36506, []).
ok
Even the following has been seen on at least one host, so that success
of gen_sctp:open/0 is no guarantee.
$ ifconfig -a4
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
bge0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
inet 10.67.16.180 netmask ffffff00 broadcast 10.67.16.255
$ erl
Erlang/OTP 20 [DEVELOPMENT] [erts-9.0] [source] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.0 (abort with ^G)
1> {ok, S} = gen_sctp:open(),
1> gen_sctp:connect(S, {127,0,0,1}, 3868, []).
{error,eafnosupport}
2> gen_sctp:connect(S, {10,67,16,180}, 3868, []).
{error,eafnosupport}
Diffstat (limited to 'lib/diameter/test/diameter_examples_SUITE.erl')
-rw-r--r-- | lib/diameter/test/diameter_examples_SUITE.erl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/diameter/test/diameter_examples_SUITE.erl b/lib/diameter/test/diameter_examples_SUITE.erl index e4ed2b227d..680ce4f366 100644 --- a/lib/diameter/test/diameter_examples_SUITE.erl +++ b/lib/diameter/test/diameter_examples_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2013-2015. All Rights Reserved. +%% Copyright Ericsson AB 2013-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -70,6 +70,8 @@ %% Transport protocols over which the example Diameter nodes are run. -define(PROTS, [tcp, sctp]). +-define(ADDR, diameter_util:ip4()). + %% =========================================================================== suite() -> @@ -346,7 +348,7 @@ top(Dir, LibDir) -> start({server, Prot}) -> ok = diameter:start(), ok = server:start(), - {ok, Ref} = server:listen(Prot), + {ok, Ref} = server:listen({Prot, ?ADDR, 3868}), [_] = ?util:lport(Prot, Ref), ok; @@ -354,7 +356,7 @@ start({client = Svc, Prot}) -> ok = diameter:start(), true = diameter:subscribe(Svc), ok = client:start(), - {ok, Ref} = client:connect(Prot), + {ok, Ref} = client:connect({Prot, ?ADDR, ?ADDR, 3868}), receive #diameter_event{info = {up, Ref, _, _, _}} -> ok end; start(Config) -> |