aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <anders@erlang.org>2013-06-02 15:02:01 +0200
committerAnders Svensson <anders@erlang.org>2013-06-02 15:02:01 +0200
commit7417446d0e3c4e5e5a15f60b1879cabef1e26408 (patch)
tree483437ca8c673856ed6c4498fd358b6d29408923
parent66afc0dfe18d33ac80ea6de949482c712e4beb9a (diff)
parent9007d1f873706cf7b33495abaae4c6ee21a77987 (diff)
downloadotp-7417446d0e3c4e5e5a15f60b1879cabef1e26408.tar.gz
otp-7417446d0e3c4e5e5a15f60b1879cabef1e26408.tar.bz2
otp-7417446d0e3c4e5e5a15f60b1879cabef1e26408.zip
Merge branch 'anders/diameter/one_failed_avp/OTP-11127' into maint
* anders/diameter/one_failed_avp/OTP-11127: Adapt CEA/DPA Failed-AVP to RFC 6733
-rw-r--r--lib/diameter/src/base/diameter_peer_fsm.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/diameter/src/base/diameter_peer_fsm.erl b/lib/diameter/src/base/diameter_peer_fsm.erl
index 65645e4dff..4e55864168 100644
--- a/lib/diameter/src/base/diameter_peer_fsm.erl
+++ b/lib/diameter/src/base/diameter_peer_fsm.erl
@@ -709,7 +709,7 @@ build_answer('CER',
rejected(Reason, {'CER', Reason, Caps, Pkt}, S)
end;
-%% The error checks below are similar to those in diameter_service for
+%% The error checks below are similar to those in diameter_traffic for
%% other messages. Should factor out the commonality.
build_answer(Type,
@@ -748,7 +748,14 @@ rejected(N, T, S) ->
rejected({N, []}, T, S).
answer(Type, RC, Es, S) ->
- set(answer(Type, RC, S), failed_avp([A || {_,A} <- Es])).
+ set(answer(Type, RC, S), failed_avp(RC, Es)).
+
+failed_avp(RC, [{RC, Avp} | _]) ->
+ [{'Failed-AVP', [{'AVP', [Avp]}]}];
+failed_avp(RC, [_ | Es]) ->
+ failed_avp(RC, Es);
+failed_avp(_, [] = No) ->
+ No.
answer(Type, RC, S) ->
answer_message(answer(Type, S), RC).
@@ -768,13 +775,6 @@ is_origin({N, _}) ->
orelse N == 'Origin-Realm'
orelse N == 'Origin-State-Id'.
-%% failed_avp/1
-
-failed_avp([] = No) ->
- No;
-failed_avp(Avps) ->
- [{'Failed-AVP', [[{'AVP', Avps}]]}].
-
%% set/2
set(Ans, []) ->
@@ -790,7 +790,7 @@ rc(#diameter_header{is_error = true}, _) ->
3008; %% DIAMETER_INVALID_HDR_BITS
rc(_, [Bs|_])
- when is_bitstring(Bs) ->
+ when is_bitstring(Bs) -> %% from old code
3009; %% DIAMETER_INVALID_HDR_BITS
rc(#diameter_header{version = ?DIAMETER_VERSION}, Es) ->