diff options
author | Anders Svensson <[email protected]> | 2013-04-23 11:49:29 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2013-05-02 18:05:52 +0200 |
commit | 9b1d1935b707f5fd19693500dfa6368580cc93e8 (patch) | |
tree | 6910b9e4b1dd7d430ef3393b150a5c64145dfd65 | |
parent | a732bb3496cf24e62b607293de7c5ae49b3891ce (diff) | |
download | otp-9b1d1935b707f5fd19693500dfa6368580cc93e8.tar.gz otp-9b1d1935b707f5fd19693500dfa6368580cc93e8.tar.bz2 otp-9b1d1935b707f5fd19693500dfa6368580cc93e8.zip |
Correct AVP Length error testcases
To return what RFC 6733 says. 3588 says less so follow 6733, even
though the extra specification of 6733 means that it isn't strictly
backwards compatible. In particular, 6733 says to send a zero'd payload
or none at all while 3588 says to send the offending AVP, despite the
fact that the peer will likely have equal difficulty in decoding it.
The testcases now fail, which will be remedied in subsequent commits.
-rw-r--r-- | lib/diameter/test/diameter_traffic_SUITE.erl | 44 |
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 5ccfd4bb6b..1d5627af5e 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; |