aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/test
AgeCommit message (Collapse)Author
2015-04-30diameter: Use module erl_annoHans Bolinder
2015-03-27Limit FQDN in DiameterURI to 255 octetsAnders Svensson
As for the port number in the parent commit, a FQDN can't be arbitrarily long, at most 255 octets. Make decode fail if it's more.
2015-03-27Limit DiameterURI ports to 0-65535 digits on decodeAnders Svensson
A port number is a 16-bit integer, but the regexp used to parse it in commit 1590920 slavishly followed the RFC 6733 grammar in matching an arbitrary number of digits. Make decode fail if it's anything more than 5, to avoid doing erlang:list_to_integer/1 on arbitrarily large lists. Also make it fail if the resulting integer is outside of the expected range.
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-26Add guard to reject {spawn_opt, false} as transport/service_opt()Anders Svensson
It was possible to configure the option, but doing so caused the service to fail when starting a watchdog process: {function_clause, [{diameter_service,'-spawn_opts/1-lc$^0/1-0-', [false], [{file,"base/diameter_service.erl"},{line,846}]}, {diameter_service,start,5, [{file,"base/diameter_service.erl"},{line,820}]}, {diameter_service,start,3, [{file,"base/diameter_service.erl"},{line,782}]}, {diameter_service,handle_call,3, [{file,"base/diameter_service.erl"},{line,385}]}, {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,607}]}, {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,639}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]} Tests for the option in the config suite were also missing. Bungled in commit 78b3dc6.
2015-03-24Merge branch 'anders/diameter/dpr/OTP-12609' into maintAnders Svensson
* anders/diameter/dpr/OTP-12609: Discard incoming/outgoing requests after incoming DPR Add transport_opt() dpr_timeout Be lenient with errors in incoming DPR
2015-03-24Reject transport=udp;protocol=diameter at DiameterURI encodeAnders Svensson
Both RFC 3588 and 6733 disallow the combination. Make its encode fail.
2015-03-24Merge branch 'anders/diameter/string_decode/OTP-11952' into maintAnders Svensson
* anders/diameter/string_decode/OTP-11952: Let examples override default service options Set {restrict_connections, false} in example server Set {string_decode, false} in examples Test {string_decode, false} in traffic suite Add service_opt() string_decode Strip potentially large terms when sending outgoing Diameter messages Improve language consistency in diameter(1)
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-24Add service_opt() string_decodeAnders Svensson
To control whether stringish Diameter types are decoded to string or left as binary. The motivation is the same as in the parent commit: to avoid large strings being copied when incoming Diameter messages are passed between processes; or *if* in the case of messages destined for handle_request and handle_answer callbacks, since these are decoded in the dedicated processes that the callbacks take place in. It would be possible to do something about other messages without requiring an option, but disabling the decode is the most effective. The value is a boolean(), true being the default for backwards compatibility. Setting false causes both diameter_caps records and decoded messages to contain binary() in relevant places that previously had string(): diameter_app(3) callbacks need to be prepared for the change. The Diameter types affected are OctetString and the derived types that can contain arbitrarily large values: OctetString, UTF8String, DiameterIdentity, DiameterURI, IPFilterRule, and QoSFilterRule. Time and Address are unaffected. The DiameterURI decode has been redone using re(3), which both simplifies and does away with a vulnerability resulting from the conversion of arbitrary strings to atom. The solution continues the use and abuse of the process dictionary for encode/decode purposes, last seen in commit 0f9cdba.
2015-03-23Add transport_opt() dpr_timeoutAnders Svensson
To cause a peer connection to be closed following an outgoing DPA, in case the peer fails to do so. It is the recipient of DPA that should close the connection according to RFC 6733.
2015-03-23Merge branch 'anders/diameter/dpr/OTP-12542' into maintAnders Svensson
* anders/diameter/dpr/OTP-12542: Discard CER or DWR sent with diameter:call/4 Allow DPR to be sent with diameter:call/4 Add transport_opt() dpa_timeout Add testcase for sending DPR with diameter:call/4
2015-03-22Add transport_opt() dpa_timeoutAnders Svensson
To make the default DPA timeout configurable. The timeout say how many milliseconds to wait for DPA in response to an outgoing DPR before terminating the transport process regardless.
2015-03-22Add testcase for sending DPR with diameter:call/4Anders Svensson
That currently fails when the resulting DPA is regarded as unsolicited in diameter_peer_fsm, causing the request to timeout at the caller.
2015-03-22Merge branch 'anders/diameter/17/time/OTP-12439' into maintAnders Svensson
* anders/diameter/17/time/OTP-12439: Adapt app suite to changes in time api
2015-03-20Merge branch 'anders/diameter/pool/OTP-12428' into maintAnders Svensson
* anders/diameter/pool/OTP-12428: Add pool_size test to config suite
2015-03-20Add pool_size test to config suiteAnders Svensson
Overlooked in commit 4b691d8d.
2015-03-19Adapt app suite to changes in time apiAnders Svensson
erlang:time_resolution/0 has been removed, erlang:convert_time_resolution/3 has been renamed convert_time_unit, and {os,erlang}:system_time/0,1 have been added. Modify the list of ignored undefined function calls accordingly.
2015-03-05Merge branch 'anders/diameter/grouped_decode/OTP-12475' into maintAnders Svensson
* anders/diameter/grouped_decode/OTP-12475: Allow encode of decoded diameter_avp list Add testcases for diameter_avp decode Fix handling of length errors on Grouped AVPs Don't discard component diameter_avp list on Grouped AVP decode error Fix process dictionary manipulation during message decode
2015-03-05Merge branch 'anders/diameter/17/time/OTP-12439' into maintAnders Svensson
* anders/diameter/17/time/OTP-12439: Ignore undefined calls to OTP 18 time api in app suite
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-03-05Merge branch 'anders/diameter/pool/OTP-12428' into maintAnders Svensson
* anders/diameter/pool/OTP-12428: Fix SCTP match blunder in suites Be backwards compatible with diameter_sctp listener state Add gen_tcp testcase that fails sporadically Simplify transport suite Remove (ancient) dead code Don't orphan slave nodes in example suite Refresh example code Improve language consistency in diameter(1) Add pool suite to test transport_opt() pool_size Adapt tcp/sctp transport modules for pool_size > 1 Add transport_opt() pool_size
2015-03-04Add testcases for diameter_avp decodeAnders Svensson
2015-03-01Ignore undefined calls to OTP 18 time api in app suiteAnders Svensson
So that the xref testcase is independent of the release it's run on. The code uses the new time api if available, so as to be forward compatible.
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-24Fix SCTP match blunder in suitesAnders Svensson
More than an incoming message can contain ancillary data, which the gen_sctp and transport suites did not expect. On FreeBSD 10, an sctp_assoc_change event appears always to contain ancillary data.
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.
2015-02-20Add gen_tcp testcase that fails sporadicallyAnders Svensson
On OS X at least. The testcase opens a listening socket, spawns 8 processes that call gen_tcp:accept/1, waits a couple of seconds, and then spawns 8 processes that call gen_tcp:connect/3. Some of these occasionally return {error, econnreset}.
2015-02-20Simplify transport suiteAnders Svensson
Using the fact that transport processes can now be started concurrently. The suite serialized starts itself when pretending to be diameter starting a transport process.
2015-02-20Don't orphan slave nodes in example suiteAnders Svensson
Stops were aborted at the first failure.
2015-02-20Add pool suite to test transport_opt() pool_sizeAnders Svensson
With testcases that uses restrict_connections and pool_size config to establish multiple connections between two Diameter nodes, checking for the expected number of transport processes using diameter:service_info/2.
2014-11-03Check {connect,watchdog}_timer distinction in event testcasesAnders Svensson
The connect timer is currently ignored by a connecting transport, so the check causes one testcase to fail.
2014-11-03Rename reconnect_timer to connect_timer in examples and suitesAnders Svensson
The timer was renamed in commit abea7186.
2014-05-29Merge branch 'anders/diameter/dictionaries/OTP-11958' into maintAnders Svensson
* anders/diameter/dictionaries/OTP-11958: Fix broken check for undefined AVPs in @codec and @custom_types Add @codecs and @custom_types tests to compiler suite
2014-05-29Add @codecs and @custom_types tests to compiler suiteAnders Svensson
Dictionary compilation fails to detect undefined AVPs in these sections.
2014-05-27Merge branch 'anders/diameter/Failed-AVP/OTP-11936' into maintAnders Svensson
* anders/diameter/Failed-AVP/OTP-11936: Do best-effort decode of Failed-AVP Add a testcase that expects a decoded value in Failed-AVP
2014-05-27Merge branch 'anders/diameter/5014/OTP-11946' into maintAnders Svensson
* anders/diameter/5014/OTP-11946: Fix handling of AVP length errors (5014) in unknown AVPs Add testcases that send unknown AVPs with a bad AVP Length
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.
2014-05-26Merge branch 'anders/diameter/sctp/OTP-11901' into maintAnders Svensson
* anders/diameter/sctp/OTP-11901: Fix diameter_sctp function_clause Anchor path regexps in examples suite Run examples suite over both TCP and SCTP
2014-05-25Merge branch 'anders/diameter/request_leak/OTP-11893' into maintAnders Svensson
* anders/diameter/request_leak/OTP-11893: Fix leaking request table Add check that request table is empty to failover suite Comment fix
2014-05-25Anchor path regexps in examples suiteAnders Svensson
They match emacs backup files and more without the anchor, although this doesn't stop the matches from finding files the suite isn't (yet) intended to test: files under development, not yet commited, etc.
2014-05-25Run examples suite over both TCP and SCTPAnders Svensson
This was supposed to already be the case (in what passes for my memory), and detects that commit ed6395a6 is horrifically broken: diameter is unable to send CEA over SCTP.
2014-05-18Add check that request table is empty to failover suiteAnders Svensson
The way in which this suite causes transport connections to be broken - by stopping the service - makes it prone to orphaning entries in the request table, which is a bug we're about to fix.
2014-05-18Comment fixAnders Svensson
2014-04-01Merge branch 'anders/diameter/17.0_release/OTP-11825'Anders Svensson
* anders/diameter/17.0_release/OTP-11825: Simplify xref tests in app suite Add app suite test for app file runtime_dependencies Generate runtime_dependencies in app file Remove syntax_tools and runtime_tools from app file
2014-03-31Simplify xref tests in app suiteAnders Svensson
By examining which modules *use* runtime and compiler modules instead of which modules compiler modules call. Note that the semantics are changed somewhat: we will now fail if diameter modules are called from an application which diameter.app lists as a start dependency, which wasn't the case previously.
2014-03-31Add app suite test for app file runtime_dependenciesAnders Svensson
In particular, that modules listed in the 'modules' tuple only call modules in other applications listed in the 'runtime_dependencies' tuple.
2014-03-31Merge branch 'anders/diameter/unicode/OTP-11686'Anders Svensson
* anders/diameter/unicode/OTP-11686: Use fun encoding to erl_parse:abstract/2 Adapt dictionary compilation to new default encoding