aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
AgeCommit message (Collapse)Author
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-05Merge branch 'anders/diameter/shutdown/OTP-12412' into maintAnders Svensson
* anders/diameter/shutdown/OTP-12412: Increase service shutdown timeout Set shutdown = infinity for supervisor children Monitor more efficiently at shutdown
2015-03-05Merge branch 'anders/diameter/retransmission/OTP-12415' into maintAnders Svensson
* anders/diameter/retransmission/OTP-12415: Fix retransmission of messages sent as header/avps list
2015-03-04Allow encode of decoded diameter_avp listAnders Svensson
The decode of an incoming request in a non-relay application results in a deep list of diameter_avp records. Encoding such a list resulted in a function_clause error in diameter_codec:pack_avp/1, which expected a flat list. The list is only flat in the relay case, or in the absence of AVPs of type Grouped. This is also related to code that exists but isn't documented. It's documented that a diameter_app(3) handle_request callback can return {relay, Opts} to relay a request received in the relay application. What's not documented is that it can also return {proxy|resend, Opts} in a non-relay application, but this leads to encode failure when there are Grouped AVPs. This shouldn't be interpreted as meaning that proxy|resend are now supported: they aren't. The two extra terms are a historical relic that should probably be removed. Neither are generally usable since, for example, a proxy agent may want to modify a request before resending it. A specific handle_request return is not needed to implement a proxy agent. Even {relay, Opts} isn't strictly necessary.
2015-03-04Add testcases for diameter_avp decodeAnders Svensson
2015-03-04Fix handling of length errors on Grouped AVPsAnders Svensson
The decode of a Grouped AVP ignored the case that extracting component AVPs with diameter_codec:collect_avps/1 returned a tuple, in the case of a truncated AVP header.
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-20Use new time api in implementationAnders Svensson
In particular, deal with the deprecation of erlang:now/0 in OTP 18. Be backwards compatible with older releases: the new api is only used when available. The test suites have not been modified.
2015-02-20Be backwards compatible with diameter_sctp listener stateAnders Svensson
Commit 24993fc2 modified the state even in the case that the new pool_size option the change was introduced to support was not used. Doing so made downgrade impossible since old code would not be prepared for the modified state. Retain a compatible state, so that simple code replacement is enough.
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-20Remove (ancient) dead codeAnders Svensson
Commit 9a671bf0 removed the need for diameter_sctp to send outgoing messages through the listening process. That was prior to R5B02, so the clause isn't need for any upgrade case.
2015-02-20Don't orphan slave nodes in example suiteAnders Svensson
Stops were aborted at the first failure.
2015-02-20Refresh example codeAnders Svensson
Which hasn't received any attention for some time. Clean it up, rename the poorly named peer.erl (it's Diameter *nodes* that are implemented), and make the it possible to specify arbitrary transport configuration.
2015-02-20Improve language consistency in diameter(1)Anders Svensson
In particular, do away with unnecessary articles in the first sentence of item lists.
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.
2015-02-20Adapt tcp/sctp transport modules for pool_size > 1Anders Svensson
In particular, that starts for the same transport reference can now be concurrent. Looking up a listener process and starting a new one if not found did handle this (more than one process could find no listener), and diameter_sctp assumed there could only be one transport process waiting for an association.
2015-02-20Add transport_opt() pool_sizeAnders Svensson
Transport processes are started by diameter one at a time. In the listening case, a transport process accepts a connection, tells the peer_fsm process, which tells its watchdog process, which tells its service process, which then starts a new watchdog, which starts a new peer_fsm, which starts a new transport process, which (finally) goes about accepting another connection. In other words, not particularly aggressive in accepting new connections. This behaviour doesn't do particularly well with a large number of concurrent connections: with TCP and 250 connecting peers we see connections being refused. This commit adds the possibilty of configuring a pool of accepting processes, by way of a new transport option, pool_size. Instead of diameter:add_transport/2 starting just a single process, it now starts the configured number, so that instead of a single process waiting for a connection there's now a pool. The option is even available for connecting processes, which provides an alternate to adding multiple transports when multiple connections to the same peer are required. In practice this also means configuring {restrict_connections, false}: this is not implicit. For backwards compatibility, the form of diameter:service_info(_,transport) differs in the connecting case, depending on whether or not pool_size is configured. Note that transport processes for the same transport_ref() can be started concurrently when pool_size > 1. This places additional requirements on diameter_{tcp,sctp}, that will be dealt with in a subsequent commit.
2015-02-17Don't discard component diameter_avp list on Grouped AVP decode errorAnders Svensson
The AVPs of an incoming Diameter message diameter_codec:decode/2,3 are decoded into a diameter_packet record in two ways: as a message-specific record in the 'msg' field and as a deep list of diameter_avp records in the 'avps' field. The record decode came first; the diameter_avp decode came later to support the Diameter relay application, but can also be convenient for non-relay applications. The diameter_avp representation can be used with outgoing messages, but what exactly is supported for isn't clearly documented. In the diameter_avp list representation, it's AVPs of type Grouped that lead to nesting: instead of a diameter_avp record, a Grouped AVP is represented by a diameter_avp list whose head is the Grouped AVP itself, and whose tail is the list of component AVPs. The diameter_avp decode was broken in the case of decode errors: the Grouped AVP was represented as a bare diameter_avp, and the component records were lost. The decode now produces the intended list. Note that component AVPs that could not be decoded will have 'undefined' in their data field.
2015-02-17Fix process dictionary manipulation during message decodeAnders Svensson
Decode can span multiple codec modules, so written entries cannot be tagged on ?MODULE.
2015-01-19Fix retransmission of messages sent as header/avps listAnders Svensson
Extracting the End-to-End and Hop-by-Hop identifiers resulted in a function clause error, causing the send to fail.
2015-01-19Increase service shutdown timeoutAnders Svensson
Shutting down the service causes DPR to be sent on all open transports under the service. These in turn have a timeout for the reception of DPA, but the timeout is bounded by the supervisor's in practice. Both timeouts were 1 second. Increase the supervisor timeout to 5 seconds. Note that the service supervisor is furthest to the right in the supervision tree in diameter_sup. Thus is significant, so that the transport-related processes aren't shutdown first.
2015-01-19Set shutdown = infinity for supervisor childrenAnders Svensson
As suggested in supervisor(3). The leaves of the supervision tree should determine the timeouts.
2015-01-19Monitor more efficiently at shutdownAnders Svensson
There's no need for building a pid list only to map it to a list of monitor references. Also, monitoring before banging the shutdown message makes for better trace, avoiding unnecessary noproc reasons when the process dies before the monitor is created.
2014-12-09Prepare releaseErlang/OTP
2014-12-01vsn -> 1.8Anders Svensson
2014-12-01Update appup for 17.4Anders Svensson
OTP-12196 remote request table leak OTP-12233 3xxx result code without E-bit OTP-12281 ignored connect_timer OTP-12308 filter ordering
2014-12-01Merge branch 'anders/diameter/filters/OTP-12308' into maintAnders Svensson
* anders/diameter/filters/OTP-12308: Order peers in pick_peer callbacks
2014-12-01Merge branch 'anders/diameter/connect_timer/OTP-12281' into maintAnders Svensson
* anders/diameter/connect_timer/OTP-12281: Tweak reason in closed event Fix ignored connect timer Check {connect,watchdog}_timer distinction in event testcases Rename reconnect_timer to connect_timer in examples and suites
2014-12-01Merge branch 'anders/diameter/3xxx/OTP-12233' into maintAnders Svensson
* anders/diameter/3xxx/OTP-12233: Fix handling of 3xxx Result-Code without E-bit
2014-11-27Order peers in pick_peer callbacksAnders Svensson
The order of peers presented to a diameter_app(3) pick_peer callback has previously not been documented, but there are use cases that are simplified by an ordering. For example, consider preferring a direct connection to a specified Destination-Host/Realm to any host in the realm. The implementation previously treated this as a special case by placing matching hosts at the head of the peers list, but the documentation made no guarantees. Now present peers in match-order, so that the desired sorting is the result of the following filter. {any, [{all, [host, realm]}, realm]} The implementation is not backwards compatible in the sense that a realm filter alone is no longer equivalent in this case. However, as stated, the documentation never made any guarantees regarding the sorting.
2014-11-03Tweak reason in closed eventAnders Svensson
From {error, Reason} to {no_connection, Reason} when a connection can't be established. The exit reason of a diameter_peer_fsm process is turned into a message from the corresponding diameter_watchdog process to the relevant diameter_service process, the latter sending a 'closed' event including the reason to any subscribers. Reason = [] when none of the configured transport modules succeeds in establishing a connection, which admittedly isn't terribly descriptive. (The lists is of error reasons from transport start functions, which is empty as long as transport processes start successfully.) Note that this form of the closed event is undocumented, aside from the documentation saying that one should expect undocumented events. The explicitly documented forms are currently specific to CER/CEA failures.
2014-11-03Fix ignored connect timerAnders Svensson
There are two timers governing the establishment of peer connections: connect_timer and watchdog_timer. The former is the RFC 6733 Tc timer and is used by diameter_service to establish an initial connection. The latter is RFC 3539 TwInit and is used by diameter_watchdog for connection reestablishment after the watchdog leaves state INITIAL. A connecting transport ignored the connect timer since the watchdog process never died, regardless of the watchdog state, causing the watchdog timer to handle reconnection. This seems to have been broken for some time.
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-10-10Fix handling of 3xxx Result-Code without E-bitAnders Svensson
Commit 00584303 broke the population of the errors field of the diameter_packet record when an incoming request with an E-bit/Result-Code mismatch was decoded. Instead of the intended {5004, #diameter_avp{value = integer()}}, the value was a 4-tuple containing the integer Result-Code.
2014-09-25Fix remote diameter_request table leakAnders Svensson
An outgoing request whose pick_peer callback selected a transport on another node resulted in an orphaned diameter_request entry on that node.
2014-09-15Update release notesErlang/OTP
2014-09-14Merge branch 'anders/diameter/17.3_release/OTP-12093' into maintAnders Svensson
* anders/diameter/17.3_release/OTP-12093: Add recompilation admonition to 17.2 release notes
2014-09-14Merge branch 'anders/diameter/Failed-AVP/OTP-12094' into maintAnders Svensson
* anders/diameter/Failed-AVP/OTP-12094: Fix ?MODULE in preprocessed dictionary forms
2014-09-14Add recompilation admonition to 17.2 release notesAnders Svensson
That dictionaries need to be recompiled, which is the case whenever diameter_gen.hrl is modified.
2014-09-12Fix ?MODULE in preprocessed dictionary formsAnders Svensson
By replacing literal diameter_gen_relay atoms in forms extracted from that module by the name of the module in question. This has been wrong for some time, but only became noticable when the parent commit started using ?MODULE as more than a process dictionary key or tag to match on. In particular, the function dict/1 in diameter_gen.hrl (included by every dictionary module) can now return ?MODULE, which is (not surprisingly) expected to be the name of the dictionary module in question. It wasn't in the case of a module compiled from forms: it was diameter_gen_relay, since that's the module the forms were extracted from. The fix only affects dictionaries compiled from forms, as returned by diameter_make:codec/2. In particular, dictionaries compiled from Erlang source returned by this function, or by diameterc(1), are unaffected.
2014-09-09Merge branch 'anders/diameter/17.3_release/OTP-12093' into maintAnders Svensson
* anders/diameter/17.3_release/OTP-12093: vsn -> 1.7.1 Update appup for OTP-12094 Update appup for OTP-12080 Update appup for OTP-12069