aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test/diameter_traffic_SUITE.erl
AgeCommit message (Collapse)Author
2015-12-21Make peer handling more efficientAnders Svensson
Each service process maintains a dictionary of peers, mapping an application alias to a {pid(), #diameter_caps{}} list of connected peers. These lists are potentially large, peers were appended to the end of the list for no particular reason, and these long lists were constructed/deconstructed when filtering them for pick_peer callbacks. Many simultaneous outgoing request could then slow the VM to a crawl, with many scheduled processes mired in list manipulation. The pseudo-dicts are now replaced by plain ets tables. The reason for them was (once upon a time) to have an interface interchangeable with a plain dict for debugging purposes, but strict swapablity hasn't been the case for some time now, and in practice a swap has never taken place. Additional tables mapping Origin-Host/Realm have also been introduced, to minimize the size of the peers lists when peers are filtered on host/realm. For example, a filter like {any, [{all, [realm, host]}, realm]} is probably a very common case: preferring a Destination-Realm/Host match before falling back on Destination-Realm alone. This is now more efficiently (but not equivalently) expressed as {first, [{all, [realm, host]}, realm]} to stop the search when the best match is made, and extracts peers from host/realm tables instead of searching through the list of all peers supporting the application in question. The code to try and start with a lookup isn't exhaustive, and the 'any' filter is still as inefficient as previously.
2015-08-13Merge branch 'anders/diameter/17/time/OTP-12926' into maint-17Erlang/OTP
* anders/diameter/17/time/OTP-12926: Simplify time manipulation Remove use of monotonic time in pre-18 code Remove unnecessary redefinition of erlang:max/2
2015-08-05Simplify time manipulationAnders Svensson
By doing away with more wrapping that the parent commit started to remove.
2015-06-18Fix decode of Grouped AVPs containing errorsAnders Svensson
RFC 6733 says this of Failed-AVP in 7.5: In the case where the offending AVP is embedded within a Grouped AVP, the Failed-AVP MAY contain the grouped AVP, which in turn contains the single offending AVP. The same method MAY be employed if the grouped AVP itself is embedded in yet another grouped AVP and so on. In this case, the Failed-AVP MAY contain the grouped AVP hierarchy up to the single offending AVP. This enables the recipient to detect the location of the offending AVP when embedded in a group. It says this of DIAMETER_INVALID_AVP_LENGTH in 7.1.5: The request contained an AVP with an invalid length. A Diameter message indicating this error MUST include the offending AVPs within a Failed-AVP AVP. In cases where the erroneous AVP length value exceeds the message length or is less than the minimum AVP header length, it is sufficient to include the offending AVP header and a zero filled payload of the minimum required length for the payloads data type. If the AVP is a Grouped AVP, the Grouped AVP header with an empty payload would be sufficient to indicate the offending AVP. In the case where the offending AVP header cannot be fully decoded when the AVP length is less than the minimum AVP header length, it is sufficient to include an offending AVP header that is formulated by padding the incomplete AVP header with zero up to the minimum AVP header length. The AVPs placed in the errors field of a diameter_packet record are intended to be appropriate for inclusion in a Failed-AVP, but neither of the above paragraphs has been followed in the Grouped case: the entire faulty AVP (non-faulty components and all) has been included. This made it impossible to identify the actual faulty AVP in all but simple case. This commit adapts the decode to the RFC, and implements the suggested single faulty AVP, nested in as many Grouped containers as required. The best-effort decode of Failed-AVP in answer messages, initially implemented in commit 0f9cdbaf, is also applied.
2015-05-24Run traffic suite over SCTPAnders Svensson
Previously it was only run over TCP. Configure a pool of accepting processes since simultaneous connections are otherwise prone to rejection, as discussed in commit 4b691d8d. Tweak timeouts to more reasonable values.
2015-05-05Fix broken traffic testcaseAnders Svensson
The send_error testcase tested that Session-Id in an answer-message was not undefined, but that's always the case since the AVP has arity 0 or 1. The correct test is that it's a list of length 1, to ensure that diameter has inserted the session id as expected.
2015-05-05Match harder in traffic suiteAnders Svensson
To ensure that the expected answer messages are received.
2015-05-05Don't confuse Result-Code and Experimental-ResultAnders Svensson
Decode of an answer message not setting the E-bit, and containing Experiment-Result but not Result-Code, identified Result-Code as the erroneous when Erroneous-Result-Code was 3xxx. Here's an example (from trace) of a the errors field after decode: [{5004, {diameter_avp,undefined,undefined,false,false,undefined,'Result-Code', 3001,undefined,undefined}}], The diameter_avp was just constructed from the AVP name and decoded result, without regard for which result code AVP contained the value. Fix by extracting the AVP from the incoming message.
2015-03-27Add service_opt() incoming_maxlenAnders Svensson
To bound the length of incoming messages that will be decoded. A message longer than the specified number of bytes is discarded. An incoming_maxlen_exceeded counter is incremented to make note of the occurrence. The motivation is to prevent a sufficiently malicious peer from generating significant load by sending long messages with many AVPs for diameter to decode. The 24-bit message length header accomodates (16#FFFFFF - 20) div 12 = 1398099 Unsigned32 AVPs for example, which the current record-valued decode is too slow with in practice. A bound of 16#FFFF bytes allows for 5461 small AVPs, which is probably more than enough for the majority of applications, but the default is the full 16#FFFFFF.
2015-03-24Test {string_decode, false} in traffic suiteAnders Svensson
By adding string decode or not in the server or client as another combination. Run all traffic cases in parallel: remove the sequential tests. Common test seems unable to deal with {group, X, [parallel]} within a group.
2015-03-05Merge branch 'anders/diameter/time/OTP-12439' into maintAnders Svensson
* anders/diameter/time/OTP-12439: Use new time api in test suites Use new time api in implementation
2015-02-25Fix error matching in traffic suiteAnders Svensson
Clause matching error for specific test cases was harmless since the subsequent clause also matched. Errors detected by the server result in Failed-AVP being sent, which should not lead to a decode error in the client.
2015-02-25Don't discard outgoing answers with Result-Code/E-bit errorsAnders Svensson
Outgoing answers missing a Result-Code AVP or setting an E-bit inappropriately were discarded, but there's no particular reason for doing so if the answer can be encoded, and the sender has no way of knowing that their answer has been discarded. It's also inappropriate that the message be discarded in the relay case. Answers are now sent, and an error counter incremented.
2015-02-20Use new time api in test suitesAnders Svensson
Where it's less important to do so, but it has to be done at some point since erlang:now/0 is deprecated. As in the parent commit, continue to use the old api if the new one is unavailable.
2014-05-26Add a testcase that expects a decoded value in Failed-AVPAnders Svensson
This isn't currently the case, but soon will be.
2014-05-26Add testcases that send unknown AVPs with a bad AVP LengthAnders Svensson
In particular, a length that points past the end of the message. This goes undetected there is some other problem with the AVP (eg. M-bit), which is a problem we're about to fix.
2013-06-10Make spawn options for request processes configurableAnders Svensson
That is, for the process that's spawned for each incoming Diameter request message.
2013-05-29Merge branch 'anders/diameter/missed_5001/OTP-11087' into maintAnders Svensson
* anders/diameter/missed_5001/OTP-11087: Remove redundant integer type specifiers from binaries Fix recognition of 5001 on mandatory AVP's
2013-05-29Merge branch 'anders/diameter/avp_decode/OTP-11007' into maintAnders Svensson
* 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
2013-05-29Merge branch 'anders/diameter/avp_length_failure/OTP-11026' into maintAnders Svensson
* anders/diameter/avp_length_failure/OTP-11026: Fix decode failure when AVP Length < 8
2013-05-29Remove redundant integer type specifiers from binariesAnders Svensson
2013-05-29Fix recognition of 5001 on mandatory AVP'sAnders Svensson
An AVP setting the M-bit was not regarded as erroneous if it was defined in the dictionary in question and its container (message or Grouped AVP) had an 'AVP' field. It's now regarded as a 5001 error (AVP_UNSUPPORTED), as in the case that the AVP is not defined.
2013-05-02Correct AVP Length error testcasesAnders Svensson
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.
2013-04-22Fix decode failure when AVP Length < 8Anders Svensson
Such a length caused decode of a message with valid (24-bit) length to fail. Note that the error detected is wrong: it should be 5014 (INVALID_AVP_LENGTH), not 3009 (INVALID_AVP_BITS). This will be dealt with by OTP-11007.
2013-04-15Minor traffic suite fixAnders Svensson
Point was to test that Session-Id was not undefined. Instead, test case send_error just returned false.
2013-04-15Lighten up on suite timetrapsAnders Svensson
Due to sporadic timeouts one some (slow) hosts.
2013-04-12Add more information to traffic suite timeout failuresAnders Svensson
In particular, have the resulting badmatch contain the starting and ending time. There are still sporadic failures on slow hosts.
2013-02-16Minor traffic suite fixAnders Svensson
2013-02-16Minor suite simplificationAnders Svensson
2013-02-08Update traffic suite to test both RFC 3588 and 6733 dictionariesAnders Svensson
2013-02-08Add testcases to traffic suiteAnders Svensson
That check for unexpected entries in the request table.
2013-01-18More testcases in traffic suiteAnders Svensson
2013-01-18Test diameter_packet answersAnders Svensson
This and record/list encode more systematically.
2013-01-17Merge branch 'maint-r15'Anders Svensson
2013-01-15Check application id in answers in traffic suiteAnders Svensson
2013-01-15Traffic suite comments plus a minor match tweakAnders Svensson
2013-01-15Add a testcaseAnders Svensson
2012-11-19Minor test suite tweaksAnders Svensson
2012-11-15Add a testcaseAnders Svensson
2012-11-05Use peer_ref() service_info in traffic suiteAnders Svensson
2012-11-05Use multiple connections in traffic suiteAnders Svensson
2012-11-05Use sequence masks in test suitesAnders Svensson
2012-10-09Use packet callbacks in traffic suiteAnders Svensson
2012-08-31Merge branch 'anders/diameter/avp_errors/OTP-10202' into maintAnders Svensson
* anders/diameter/avp_errors/OTP-10202: Add a testcase Fix answer-message blunder
2012-08-31Add a testcaseAnders Svensson
2012-08-26Lighten up on timetraps in test suitesAnders Svensson
Some look to be optimistic when running in slow virtual environments. (With bad time keeping?)
2011-12-16Use new syntax for specifying ct group propertiesAnders Svensson
No longer have to duplicate groups for sequential and parallel runs.
2011-12-16Remove trailing whitespaceAnders Svensson
2011-12-02Remove unnecessary includesAnders Svensson
2011-11-10Use trivial capabilities callback in traffic suiteAnders Svensson