aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test/diameter_traffic_SUITE.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-05-29 18:40:34 +0200
committerAnders Svensson <[email protected]>2013-05-29 18:40:34 +0200
commit840d4aa36aefca16990f0dc3bc5597346d36af01 (patch)
tree799d47e2cdbf1bb9e7764af7ba0c45bb34708a01 /lib/diameter/test/diameter_traffic_SUITE.erl
parentaecb2d0c041d43659f57235fe6b14478663e6444 (diff)
parent38a75600cbd5b51ae61921df78cc02348e563564 (diff)
downloadotp-840d4aa36aefca16990f0dc3bc5597346d36af01.tar.gz
otp-840d4aa36aefca16990f0dc3bc5597346d36af01.tar.bz2
otp-840d4aa36aefca16990f0dc3bc5597346d36af01.zip
Merge branch 'anders/diameter/avp_decode/OTP-11007' into maint
* anders/diameter/avp_decode/OTP-11007: Detect all 5005 (MISSING_AVP) errors and don't reverse errors Adapt Failed-AVP setting to RFC 6733 Add spec to diameter_codec Add spec to diameter_gen Fix recognition of 5014 (INVALID_AVP_LENGTH) errors Ensure setting Failed-AVP is appropriate Correct AVP Length error testcases
Diffstat (limited to 'lib/diameter/test/diameter_traffic_SUITE.erl')
-rw-r--r--lib/diameter/test/diameter_traffic_SUITE.erl44
1 files changed, 25 insertions, 19 deletions
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl
index 3878d6717a..f222e4a3ab 100644
--- a/lib/diameter/test/diameter_traffic_SUITE.erl
+++ b/lib/diameter/test/diameter_traffic_SUITE.erl
@@ -487,31 +487,31 @@ send_unsupported_version(Config) ->
%% Send a request containing an AVP length > data size.
send_long_avp_length(Config) ->
- Req = ['STR', {'Termination-Cause', ?LOGOUT}],
-
- ?answer_message(?INVALID_AVP_BITS)
- = call(Config, Req).
+ send_invalid_avp_length(Config).
%% Send a request containing an AVP length < data size.
send_short_avp_length(Config) ->
- Req = ['STR', {'Termination-Cause', ?LOGOUT}],
+ send_invalid_avp_length(Config).
- ['STA', _SessionId, {'Result-Code', ?INVALID_AVP_LENGTH} | _]
- = call(Config, Req).
+%% Send a request containing an AVP whose advertised length is < 8.
+send_zero_avp_length(Config) ->
+ send_invalid_avp_length(Config).
%% Send a request containing an AVP length that doesn't match the
%% AVP's type.
send_invalid_avp_length(Config) ->
Req = ['STR', {'Termination-Cause', ?LOGOUT}],
- ['STA', _SessionId, {'Result-Code', ?INVALID_AVP_LENGTH} | _]
- = call(Config, Req).
-
-%% Send a request containing an AVP whose advertised length is < 8.
-send_zero_avp_length(Config) ->
- Req = ['STR', {'Termination-Cause', ?LOGOUT}],
-
- ?answer_message(?INVALID_AVP_BITS)
+ ['STA', _SessionId,
+ {'Result-Code', ?INVALID_AVP_LENGTH},
+ _OriginHost,
+ _OriginRealm,
+ _UserName,
+ _Class,
+ _ErrorMessage,
+ _ErrorReportingHost,
+ {'Failed-AVP', [#'diameter_base_Failed-AVP'{'AVP' = [_]}]}
+ | _]
= call(Config, Req).
%% Send a request containing 5xxx errors that the server rejects with
@@ -828,19 +828,25 @@ prepare(Pkt, Caps, N, #group{client_dict0 = Dict0} = Group)
N == send_zero_avp_length ->
Req = prepare(Pkt, Caps, Group),
%% Second last AVP in our STR is Auth-Application-Id of type
- %% Unsigned32: set AVP Length to a value other than 12.
+ %% Unsigned32: set AVP Length to a value other than 12 and place
+ %% it last in the message (so as not to mess with Termination-Cause).
#diameter_packet{header = #diameter_header{length = L},
bin = B}
= E
= diameter_codec:encode(Dict0, Pkt#diameter_packet{msg = Req}),
- Offset = L - 7 - 12, %% to AVP Length
- <<H:Offset/binary, 12:24/integer, T:16/binary>> = B, %% assert
+ Offset = L - 24, %% to Auth-Application-Id
+ <<H:Offset/binary,
+ Hdr:5/binary, 12:24/integer, Data:4/binary,
+ T:12/binary>>
+ = B,
AL = case N of
send_long_avp_length -> 13;
send_short_avp_length -> 11;
send_zero_avp_length -> 0
end,
- E#diameter_packet{bin = <<H/binary, AL:24/integer, T/binary>>};
+ E#diameter_packet{bin = <<H/binary,
+ T/binary,
+ Hdr/binary, AL:24/integer, Data/binary>>};
prepare(Pkt, Caps, N, #group{client_dict0 = Dict0} = Group)
when N == send_invalid_avp_length;