aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
AgeCommit message (Collapse)Author
2014-05-27Change answer_errors default from report to discardAnders Svensson
In the same vein as commit 00584303, to avoid logging traffic-related happenings. Not that the value in diameter.hrl is just documentation: the value is set explicitly when diameter:start_service/2 creates diameter_app records.
2014-05-26Don't count messages on arbitrary keysAnders Svensson
That is, don't use a key constructed from an incoming Diameter header unless the message is known to the dictionary in question. Otherwise there are 2^32 application ids, 2^24 command codes, and 2 R-bits for an ill-willed peer to choose from, each resulting in new keys in the counter table (diameter_stats). The usual {ApplicationId, CommandCode, Rbit} in a key is replaced by the atom 'unknown' if the message in question is unknown to the decoding dictionary. Counters for messages sent and received by a relay are (still) not implemented.
2014-05-26Replace traffic-related log reports with no-op function callsAnders Svensson
The former were a little over-enthusiastic and could cause a node to be logged to death if a peer Diameter node was sufficiently ill-willed. The function calls are to diameter_lib:log/4, the arguments of which identify the happening in question, and which does nothing but provide a function to trace on. Many existing log calls have been shrunk. The only remaining traffic-related report (hopefully) is that resulting from {answer_errors, report} config, and this has been slimmed.
2014-05-25Merge branch 'anders/diameter/rc_counters/OTP-11937' into maintAnders Svensson
* anders/diameter/rc_counters/OTP-11937: Count encode errors in outgoing messages Count decode errors in incoming requests Count decode errors independently of result codes
2014-05-25Merge branch 'anders/diameter/rc_counters/OTP-11891' into maintAnders Svensson
* anders/diameter/rc_counters/OTP-11891: Count result codes in CEA/DWA/DPA
2014-05-25Merge branch 'anders/diameter/watchdog_leak/OTP-11934' into maintAnders Svensson
* anders/diameter/watchdog_leak/OTP-11934: Simplify sending of 'close' to watchdog Fix watchdog table leak
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-23Count encode errors in outgoing messagesAnders Svensson
Only decode errors were counted previously. Keys are of the form {Id, send, error}, where Id is: {ApplicationId, CommandCode, Rbit} | unknown The latter will be the case if not even a #diameter_header{} can be constructed.
2014-05-22Count decode errors in incoming requestsAnders Svensson
Errors were only counted in incoming answers. Counters are keyed on tuples of the same form: {{ApplicationId, CommandCode, Rbit}, recv, error}
2014-05-22Count decode errors independently of result codesAnders Svensson
Since the former doesn't exclude the latter. Counter values are returned by diameter:service_info/2. They can currently only be retrieved for a service, not for individual transports or peer connections.
2014-05-21Count result codes in CEA/DWA/DPAAnders Svensson
Corresponding counters for other answer messages have been counted previously, but those for CEA, DWA, and DPA have been missing since diameter itself sends these messages and the implementation is as bit more separate than it might be. The counters are keyed on values of the following form. {{ApplicationId, CommandCode, 0 = Rbit}, send|recv, {'Result-Code', RC}}
2014-05-20Simplify sending of 'close' to watchdogAnders Svensson
There's no need to send the message immediately if there's no transport configuration since that in itself means the service process will tell the watchdogs to die.
2014-05-20Fix watchdog table leakAnders Svensson
Commit ef5fddcb (diameter-1.4.1, R16B) caused the leak in the case of an accepting watchdog with restrict_connections = false. It (correctly) ensured the state remained at INITIAL but a subsequent 'close' message to terminate the process was ignored since the state was not DOWN. In fact, no 'close' was sent since there was no state transition or previous connection: the former triggers the message from diameter_service, the latter from diameter_watchdog. The message is now sent to self() from the watchdog itself. Send 'close' in the same way when multiple connections to the same peer are allowed, to avoid waiting for a watchdog timer expiry for the process to terminate in this case.
2014-05-18Fix leaking request tableAnders Svensson
A new connection writes the pid to the table diameter_request. The normal handling is that loss of a connection leads to a watchdog state change in the service process, which removes the entry, but this usually won't happen in the case of diameter:stop_service/1 since the service process is terminated without waiting for watchdog transitions. The request table should really be service-specific, so that the table is deleted when the service is stopped, which requires passing the table identifier into request processes and handling that the table may not exist. Just clear out the service-specific entries at service process termination for now.
2014-04-03Merge branch 'anders/diameter/17.0_release/OTP-11605'Anders Svensson
* anders/diameter/17.0_release/OTP-11605: Bring diameter_dbg into the present
2014-04-02Bring diameter_dbg into the presentAnders Svensson
The module is just a collection of functions for retrieving or printing information for the purpose of debugging. Various changes over several releases had broken the table-listing functions diameter_peer/0 and diameter_service/0. Add some minor tidying as well.
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-31Generate runtime_dependencies in app fileAnders Svensson
To avoid having to specify applications more than once.
2014-03-31Merge branch 'anders/diameter/unicode_path/OTP-11655'Anders Svensson
* anders/diameter/unicode_path/OTP-11655: Fix unicode path failure in diameter_make:codec/2
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
2014-03-31Merge branch 'anders/diameter/pick_peer/OTP-11789'Anders Svensson
* anders/diameter/pick_peer/OTP-11789: Fix pick_peer case clause failure
2014-03-30Remove syntax_tools and runtime_tools from app fileAnders Svensson
The former is used by the dictionary compiler, the latter by some unfinished code in diameter_dbg. None of the corresponding modules are included in the app file since they typically aren't needed/wanted on a target system.
2014-03-30Merge branch 'anders/diameter/17.0_release/OTP-11605'Anders Svensson
* anders/diameter/17.0_release/OTP-11605: Move info modules into own subdirectory Include compiler and info modules in app file Remove unused diameter_dbg:log/4 Remove case expecting a pre-R16B return value from os:type/1 Fix doc typo: required -> requires Remove release note unrelated to functionality
2014-03-29Move info modules into own subdirectoryAnders Svensson
Possibly overkill for two modules but it mirrors their different treatment by the makefile.
2014-03-29Include compiler and info modules in app fileAnders Svensson
Albeit as comments. This is just to make it more obvious that these aren't include in the modules list, since they typically aren't needed/wanted on a target system. Also add comments for the corresponding dependencies on syntax_tools and runtime_tools, as well as the optional runtime dependency on ssl.
2014-03-29Remove unused diameter_dbg:log/4Anders Svensson
It was intended to replace diameter_lib:log/4 at some point but that was a bad idea since diameter_dbg isn't included in the app file.
2014-03-29Remove case expecting a pre-R16B return value from os:type/1Anders Svensson
The documented return value changed in commit c37a9761.
2014-03-25Use fun encoding to erl_parse:abstract/2Anders Svensson
This is an encoding that didn't exist at the time of the previous commit, but which was added in commit 83b6daef. Use it to restrict stringification to lists containing printable ascii.
2014-03-21Adapt dictionary compilation to new default encodingAnders Svensson
The problem is that the change in default encoding to utf8 in 17.0, in commit 00e42967, changes the behaviour of erl_parse:abstract/1, which is used by the dictionary compiler to turn terms into abstract code. In particular, it transforms the orddict representation of a parsed dictionary to contruct the return value of a dictionary module's dict/0 function. This orddict contains various lists, one of which is a list of tuples of the form {Name, Code, [VendorId], [Avp]} where Name is an ASCII string and VendorId is a non-negative integer. Using erl_parse:abstract/2 instead allows a string encoding to be specified but regardless of what encoding is used, the result of transforming our tuple might not be what we really want, which is for Name to always be represented as a string form and [VendorId] to always be represented as a cons form: the [VendorId] will always end up as a string form if the integers are small enough. The only way around this is to transform the tuple bit by bit, but modifying the code to do this is quite a lot of work, for not much gain: it would be nice to produce more readable output but nothing stops working without it. This commit restores the pre-17.0 conversion by explicilty specifying latin1 as the string encoding to erl_parse:abstract/2. The utf8 encoding broke the compilation of some dictionares since unicode strings aren't expected when writing the generated code to file. Note that the latin1 encoding does reasonably well in practice, although it mangles the Ericsson Vendor Id list [193] into a "LATIN CAPITAL LETTER A WITH ACUTE". The utf8 encoding does worse, mangling the 3GPP Vendor Id 10415 into "DESERET CAPITAL LETTER CHEE". An ascii encoding would do better than latin1 but doesn't yet exist. (Encoding isn't really what the option is. It's a string predicate: if the predicate is true then represent as a string form, otherwise a cons form.)
2014-03-20Fix unicode path failure in diameter_make:codec/2Anders Svensson
A dictionary path containing a unicode codepoint > 255 caused the function to fail when iolist_to_binary/1 was applied to the path.
2014-03-20Fix pick_peer case clause failureAnders Svensson
In the case of {call_mutates_state, true} configuration on the service in question, any peer selection that failed to select a peer resulted in a case clause failure in diameter_service:pick_peer/5, when the call to the service process returned false. This was noticed in the case of a peer failover in which an alternate peer wasn't available. The explicit matching is intentional, to match exactly what's expected.
2014-03-20Introduce runtime_dependencies in .app filesRickard Green
Most dependencies introduced are exactly the dependencies to other applications found by xref. That is, there might be real dependencies missing. There might also be pure debug dependencies listed that probably should be removed. Each application has to be manually inspected in order to ensure that all real dependencies are listed. All dependencies introduced are to application versions used in OTP 17.0. This since the previously used version scheme wasn't designed for this, and in order to minimize the work of introducing the dependencies.
2014-02-19Use inet:{peer,sock}names/1 in diameter_sctpAnders Svensson
OTP-10229 (commit c4592b69) added these function to give access to all addresses on a multihomed endpoint, their singular siblings not returning anything useful in this case. This fixes {accept, Match} config, which matches peer addresses against configured addresses or regexps to decide whether or not a newly established association should be retained. The functionality was added in OTP-10893 (commit 9bbf27eb) but predated OTP-10229 by a few months. It also fixes the addresses shown for SCTP associations in diameter:service_info/2 output.
2014-01-28Merge branch 'anders/diameter/17.0_release/OTP-11605'Anders Svensson
* anders/diameter/17.0_release/OTP-11605: vsn -> 1.6 Remove upgrade-related code Update appup for 17.0 Avoid type gen_sctp:open_option() until it actually exists
2014-01-27Remove upgrade-related codeAnders Svensson
No longer needed to update code in runtime since the emulator is restarted at a major release.
2014-01-27Update appup for 17.0Anders Svensson
Plan to make use of the emulator restart implied by a major release to clean out some upgrade-related code.
2014-01-27Avoid type gen_sctp:open_option() until it actually existsAnders Svensson
The type's existence is the subject of OTP-11139, which has been gathering dust since R16B. http://erlang.org/pipermail/erlang-bugs/2013-September/003765.html
2014-01-27Merge branch 'anders/diameter/sctp_streams/OTP-11593'Anders Svensson
* anders/diameter/sctp_streams/OTP-11593: Change interface for communicating outbound stream id to diameter_sctp
2014-01-24Change interface for communicating outbound stream id to diameter_sctpAnders Svensson
The module uses the transport_data field of record diameter_packet to communicate the stream on which the an incoming message is received and on which an outgoing message should be sent, the previous interface being that both are communicated as a tuple of the form {stream, Id}. However, since diameter retains the value of an incoming request's transport_data unless the corresponding answer message specifies otherwise, the behaviour in this case is to send an answer on the outbound stream with the same identifier as the that of the inbound stream on which the request was received. If the inbound stream id is greater than or equal to the number of outbound streams then this is guaranteed to fail, causing the transport process in question to terminate. There is no relationship between inbound and outbound stream identifiers so diameter_sctp's imposition of one is simply wrong. Outbound stream ids are now communicated with a different tuple: {outstream, Id}, interpreted modulo the number of outbound streams. Thus, retention of an inbound request's transport_data has no effect on the selection of an outbound stream. The change in interface is not strictly backwards compatible because of the new atom for the outbound stream. However, as there is currently no documented way of obtaining the available number of outbound streams for a peer connection, there is no way for a client to have known the range of ids from which it could reliably have chosen with the previous interface, so any setting of the outbound stream has probably been unintentional. Not explicitly specifying an outbound stream now results in a round-robin selection.
2014-01-16Ensure that Grouped AVP's are fully defined in dictionariesAnders Svensson
The case in which an AVP was defined as having type Grouped in @avp_types without a corresponding specification in @grouped was missing.
2014-01-16Don't format diameter_make:codec/2 errorsAnders Svensson
Instead, add diameter_make:format_error/1 to allow the caller to format if desired, which is what applications like compiler and yecc do. Use this to check that the expected error is the one actually generated in the compiler suite.
2013-12-02Merge branch 'anders/diameter/R16B03_release/OTP-11499' into maintAnders Svensson
* anders/diameter/R16B03_release/OTP-11499: vsn -> 1.5 Update appup for OTP-11168 Update appup for OTP-11361 Add makefile to build example dictionaries Add recent Diameter-related RFCs Generate diameterc.1, not diameter_compile.1 Fix documentation typos Fix appup blunder
2013-12-02Merge branch 'anders/diameter/timer_confusion/OTP-11168' into maintAnders Svensson
* anders/diameter/timer_confusion/OTP-11168: Rename reconnect_timer -> connect_timer
2013-12-02Merge branch 'anders/diameter/dictionary_make/OTP-11348' into maintAnders Svensson
* anders/diameter/dictionary_make/OTP-11348: Return compilable forms instead of beam Document diameter_make:format/1 and diameter_make:flatten/1 Fix diameter_make:flatten/1 Modify type that currently causes dialyzer woe Simplify and extend diameter_make interface Add diameter_make:flatten/1, remove reformat/1 Adapt compiler suite to diameter_make Remove dead code from codec suite Extend diameter_make:codec/2 Don't pollute process dictionary in diameter_codegen:from_dict/4 Make forms a separate output from diameter_codegen Remove last remnants of "spec" Write as last step in code generation Change extensions for debug output: .spec/forms -> .D/F
2013-12-01Return compilable forms instead of beamAnders Svensson
That is, preprocessed forms that can be passed to compile:forms/1,2.
2013-12-01Fix diameter_make:flatten/1Anders Svensson
To set @avp_vendor_id, @codecs and @custom_types as required for imported avps.
2013-12-01Modify type that currently causes dialyzer woeAnders Svensson
The intention was that the type would represent an improper list whose head was an integer and whose tail was an orddict but that doesn't seem to be dialyzer's interpretation anyway.
2013-12-01Simplify and extend diameter_make interfaceAnders Svensson
In particular, make codec/2 flexible as to what's generated, the formats (erl, hrl, parse, forms and beam) being passed in the options list and defaulting to [erl, hrl]. The 'parse' format is the internal format to which dictionaries are parsed, which can be manipulated by flatten/1 before being passed back to codec/2 or format/1. Remove the (undocumented) dict/1,2 since codec/2 now subsumes it with the 'parse' option.
2013-12-01Add diameter_make:flatten/1, remove reformat/1Anders Svensson
The latter is now unnecessary given that codec/2 can return a parse and format/1 can return the dictionary format.
2013-11-30Update appup for OTP-11168Anders Svensson