aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-05-15 09:37:33 +0200
committerAnders Svensson <[email protected]>2015-05-18 14:10:43 +0200
commit3e7ec99afb2469cff4e776de5b6d16909315ff88 (patch)
treed9df6f6a3c5f07b149a9c3bc11351bad6c3b0188
parentca72fdaa517d6d541c7176eda5edf9908d745ce8 (diff)
downloadotp-3e7ec99afb2469cff4e776de5b6d16909315ff88.tar.gz
otp-3e7ec99afb2469cff4e776de5b6d16909315ff88.tar.bz2
otp-3e7ec99afb2469cff4e776de5b6d16909315ff88.zip
Fix broken relay counters
Commit 49e8b11c broke the counting of relayed message, causing them to be accumulated as unknown messages.
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 5d077222c2..e8afa089ef 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -1081,6 +1081,9 @@ incr_result(Dir, Pkt, TPid, {Dict, AppDict, Dict0}) ->
= Pkt,
Id = msg_id(Hdr, AppDict),
+ %% Could be {relay, 0}, in which case the R-bit is redundant since
+ %% only answers are being counted. Let it be however, so that the
+ %% same tuple is in both send/recv and result code counters.
%% Count incoming decode errors.
recv /= Dir orelse [] == Es orelse incr_error(Dir, Id, TPid, AppDict),
@@ -1107,10 +1110,11 @@ msg_id(#diameter_packet{header = H}, Dict) ->
%% pairs for an attacker to choose from.
msg_id(Hdr, Dict) ->
{Aid, Code, R} = Id = diameter_codec:msg_id(Hdr),
- if Aid == ?APP_ID_RELAY ->
+ case Dict:id() of
+ ?APP_ID_RELAY ->
{relay, R};
- true ->
- choose(Aid /= Dict:id() orelse '' == Dict:msg_name(Code, 0 == R),
+ A ->
+ choose(A /= Aid orelse '' == Dict:msg_name(Code, 0 == R),
unknown,
Id)
end.