aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_traffic.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-04-24 11:28:10 +0200
committerAnders Svensson <[email protected]>2013-05-03 01:45:13 +0200
commitcf37640e614ca0d9172b2b630eeb0672967cb9e3 (patch)
treee74320eac691ee79be7b5d11248bc761b50a326e /lib/diameter/src/base/diameter_traffic.erl
parent9b1d1935b707f5fd19693500dfa6368580cc93e8 (diff)
downloadotp-cf37640e614ca0d9172b2b630eeb0672967cb9e3.tar.gz
otp-cf37640e614ca0d9172b2b630eeb0672967cb9e3.tar.bz2
otp-cf37640e614ca0d9172b2b630eeb0672967cb9e3.zip
Ensure setting Failed-AVP is appropriate
When setting Failed-AVP in a message record, it was never tested that the field was actually present. RFC 6733 says it should be, 3588 says MAY.
Diffstat (limited to 'lib/diameter/src/base/diameter_traffic.erl')
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 25b902e3f2..1ba5cf0b3e 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -621,8 +621,8 @@ reset(#diameter_packet{msg = Msg, errors = Es} = Pkt, Dict) ->
reset(Msg, Dict, Es)
when is_list(Es) ->
- {E3, E5, Fs} = partition(Es),
- FailedAVP = failed_avp(Msg, lists:reverse(Fs), Dict),
+ {E3, E5, Failed} = partition(Es),
+ FailedAVP = failed_avp(Msg, Failed, Dict),
reset(set(Msg, FailedAVP, Dict),
Dict,
choose(is_answer_message(Msg, Dict), E3, E5));
@@ -740,14 +740,14 @@ rc(Rec, T, Dict) ->
failed_avp(_, [] = No, _) ->
No;
-failed_avp(Rec, Failed, Dict) ->
- [fa(Rec, [{'AVP', Failed}], Dict)].
+failed_avp(Rec, Avps, Dict) ->
+ [failed(Rec, [{'AVP', lists:reverse(Avps)}], Dict)].
%% Reply as name and tuple list ...
-fa([MsgName | Values], FailedAvp, Dict) ->
- R = Dict:msg2rec(MsgName),
+failed([MsgName | Values], FailedAvp, Dict) ->
+ RecName = Dict:msg2rec(MsgName),
try
- Dict:'#info-'(R, {index, 'Failed-AVP'}),
+ Dict:'#info-'(RecName, {index, 'Failed-AVP'}),
{'Failed-AVP', [FailedAvp]}
catch
error: _ ->
@@ -758,8 +758,10 @@ fa([MsgName | Values], FailedAvp, Dict) ->
end;
%% ... or record.
-fa(Rec, FailedAvp, Dict) ->
+failed(Rec, FailedAvp, Dict) ->
try
+ RecName = element(1, Rec),
+ Dict:'#info-'(RecName, {index, 'Failed-AVP'}),
{'Failed-AVP', [FailedAvp]}
catch
error: _ ->