aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-01-16 19:17:36 +0100
committerAnders Svensson <[email protected]>2013-01-18 16:02:53 +0100
commit0e3ffbd96d652dbc7d16e582bf402a5aaa991b6d (patch)
tree685f9f1341775a904cd139666f24093f90f8ac29 /lib/diameter
parent2a6407b3f744ae3d170764eac9d9eb882148b898 (diff)
downloadotp-0e3ffbd96d652dbc7d16e582bf402a5aaa991b6d.tar.gz
otp-0e3ffbd96d652dbc7d16e582bf402a5aaa991b6d.tar.bz2
otp-0e3ffbd96d652dbc7d16e582bf402a5aaa991b6d.zip
Ensure correct setting of 3xxx result code
A bad AVP Length (resulting in excess bytes from decode) but no other errors caused the request to fail when attempting to set Result-Code. A protocol error in combination with a 5xxx error caused the latter to be set in an answer-message.
Diffstat (limited to 'lib/diameter')
-rw-r--r--lib/diameter/src/base/diameter_service.erl13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/diameter/src/base/diameter_service.erl b/lib/diameter/src/base/diameter_service.erl
index c0fccd8080..b5584ca0d0 100644
--- a/lib/diameter/src/base/diameter_service.erl
+++ b/lib/diameter/src/base/diameter_service.erl
@@ -2060,9 +2060,15 @@ request_cb({eval, RC, F}, App, Mask, T, TC, Fs, Pkt) ->
%% protocol_error/5
protocol_error(RC, {_, OH, OR}, TPid, Fs, Pkt) ->
- #diameter_packet{avps = Avps} = Pkt,
+ #diameter_packet{avps = Avps, errors = Es} = Pkt,
?LOG({error, RC}, Pkt),
- reply(answer_message({OH, OR, RC}, Avps), ?BASE, TPid, Fs, Pkt).
+ reply(answer_message({OH, OR, RC}, Avps),
+ ?BASE,
+ TPid,
+ Fs,
+ Pkt#diameter_packet{errors = [RC | Es]}).
+%% Note that reply/5 may set the result code once more. It's set in
+%% answer_message/2 in case reply/5 doesn't.
%% protocol_error/4
@@ -2175,7 +2181,8 @@ is_loop(Code, Vid, OH, Avps) ->
%%
%% Send a locally originating reply.
-%% Skip the setting of Result-Code and Failed-AVP's below.
+%% Skip the setting of Result-Code and Failed-AVP's below. This is
+%% currently undocumented.
reply([Msg], Dict, TPid, Fs, Pkt)
when is_list(Msg);
is_tuple(Msg) ->