aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2014-08-05 14:57:56 +0200
committerAnders Svensson <[email protected]>2014-08-05 16:35:14 +0200
commit7816ab2fc42307bcffd1cfbd40bbbab30c226fb9 (patch)
tree1001280fb794b2837fadf9a4903d4a563c89c5ae
parent50356d68b321f959fda4b2bf5c77453cd1fb6890 (diff)
downloadotp-7816ab2fc42307bcffd1cfbd40bbbab30c226fb9.tar.gz
otp-7816ab2fc42307bcffd1cfbd40bbbab30c226fb9.tar.bz2
otp-7816ab2fc42307bcffd1cfbd40bbbab30c226fb9.zip
Count relayed messages on {relay, Rbit}
Instead of grouping them with 'unknown'. These messages were keyed on {ApplicationId, CommandCode, Rbit} prior to commit df19c272, but distinguishing between the relay application and others is probably more useful. The only reason for not including the R-bit in the unknown key is that the key is also used elsewhere, and relay is an expected case while unknown isn't.
-rw-r--r--lib/diameter/src/base/diameter_traffic.erl18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/diameter/src/base/diameter_traffic.erl b/lib/diameter/src/base/diameter_traffic.erl
index 33062e928c..f3c4e63afc 100644
--- a/lib/diameter/src/base/diameter_traffic.erl
+++ b/lib/diameter/src/base/diameter_traffic.erl
@@ -1074,12 +1074,22 @@ incr_rc(Dir, Pkt, Dict, TPid, Dict0) ->
incr(TPid, {Id, Dir, Ctr}),
Ctr.
-%% Only count on known keeps so as not to be vulnerable to attack:
-%% there are 2^32 (application ids) * 2^24 (command codes) * 2 (R-bits)
-%% = 2^57 Ids for an attacker to choose from.
+%% Only count on known keys so as not to be vulnerable to attack:
+%% there are 2^32 (application ids) * 2^24 (command codes) = 2^56
+%% pairs for an attacker to choose from.
msg_id(Hdr, Dict) ->
{_ApplId, Code, R} = Id = diameter_codec:msg_id(Hdr),
- choose('' == Dict:msg_name(Code, 0 == R), unknown, Id).
+ case Dict:msg_name(Code, 0 == R) of
+ '' ->
+ unknown(Dict:id(), R);
+ _ ->
+ Id
+ end.
+
+unknown(?APP_ID_RELAY, R) ->
+ {relay, R};
+unknown(_, _) ->
+ unknown.
%% No E-bit: can't be 3xxx.
is_result(RC, false, _Dict0) ->