aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-11-04 17:11:18 +0100
committerAnders Svensson <[email protected]>2011-11-10 16:23:50 +0100
commite0854b9ffed89fb8bd61e8b57a0e5e933906207b (patch)
tree7c9905372bd86a947738c569b6153e6c51b8a47c /lib/diameter/src
parent020e92da676417dd1ab955d3ac81199972cace64 (diff)
downloadotp-e0854b9ffed89fb8bd61e8b57a0e5e933906207b.tar.gz
otp-e0854b9ffed89fb8bd61e8b57a0e5e933906207b.tar.bz2
otp-e0854b9ffed89fb8bd61e8b57a0e5e933906207b.zip
Accept any 2xxx result code in CEA
Diffstat (limited to 'lib/diameter/src')
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index d754c1bcc8..fae5d763dc 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -55,7 +55,8 @@
-define(NO_INBAND_SECURITY, 0).
-define(TLS, 1).
--define(LOOP_TIMEOUT, 2000).
+%% A 2xxx series Result-Code. Not necessarily 2001.
+-define(IS_SUCCESS(N), 2 == (N) div 1000).
%% RFC 3588:
%%
@@ -706,7 +707,7 @@ handle_CEA(#diameter_packet{bin = Bin}
%% connection with the peer.
try
- 2001 == RC
+ ?IS_SUCCESS(RC)
orelse ?THROW(RC),
[] == SApps
andalso ?THROW(no_common_application),
@@ -720,8 +721,11 @@ handle_CEA(#diameter_packet{bin = Bin}
catch
?FAILURE(Reason) -> close({'CEA', Reason, Caps, DPkt}, S)
end.
-%% Check more than the result code since the peer could send 2001
-%% regardless.
+%% Check more than the result code since the peer could send success
+%% regardless. If not 2001 then a peer_up callback could do anything
+%% required. It's not unimaginable that a peer agreeing to TLS after
+%% capabilities exchange could send DIAMETER_LIMITED_SUCCESS = 2002,
+%% even if this isn't required by RFC 3588.
%% recv_CEA/2
@@ -754,7 +758,7 @@ ccb([F | Rest], T) ->
case diameter_lib:eval([F|T]) of
ok ->
ccb(Rest, T);
- N when 2 == N div 1000 -> %% 2xxx Result-Code
+ N when ?IS_SUCCESS(N) -> %% 2xxx result code: accept immediately
N;
Res ->
?THROW({capabilities_cb, F, rejected(Res)})