aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
AgeCommit message (Collapse)Author
2014-06-11Corrected module name in appup fileMicael Karlberg
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-29Fix broken check for undefined AVPs in @codec and @custom_typesAnders Svensson
Instead of detecting the error, code generation failed when attempting to lookup the type of an undefined AVP.
2014-05-28Merge branch 'anders/diameter/17.1/OTP-11943' into maintAnders Svensson
* anders/diameter/17.1/OTP-11943: Update appup for OTP-11946, OTP-11936: 5014, Failed-AVP decode Update appup for OTP-11938: terminate watchdog after DPR reception Update appup for OTP-11721: log and counter hardening Update appup for OTP-11937: counters Update appup for OTP-11901: diameter_sctp function_clause Update appup for OTP-11934: watchdog process leak Update appup for OTP-11893: request table leak Update appup for OTP-11891: result code counters for CEA/DWA/DPA vsn -> 1.7 Fix broken release note for diameter-1.4.4
2014-05-28Merge branch 'anders/diameter/hardening/OTP-11721' into maintAnders Svensson
* anders/diameter/hardening/OTP-11721: Change answer_errors default from report to discard
2014-05-28Update appup for OTP-11938: terminate watchdog after DPR receptionAnders Svensson
Modules: diameter_watchdog, diameter_peer_fsm diameter_watchdog must be loaded first.
2014-05-28Update appup for OTP-11721: log and counter hardeningAnders Svensson
Modules: diameter_codec, diameter_peer_fsm, diameter_watchdog, diameter_traffic, diameter_service, diameter_lib, dictionary modules diameter_lib and diameter_traffic (in that order) must be loaded first. diameter_codec last must be loaded before diameter_peer_fsm and diameter_watchdog.
2014-05-27Update appup for OTP-11937: countersAnders Svensson
Modules: diameter_peer_fsm, diameter_watchdog, diameter_codec, diameter_traffic diameter_traffic must be loaded first.
2014-05-27Update appup for OTP-11901: diameter_sctp function_clauseAnders Svensson
2014-05-27Update appup for OTP-11893: request table leakAnders Svensson
Modules: diameter_service
2014-05-27Update appup for OTP-11891: result code counters for CEA/DWA/DPAAnders Svensson
Modules: diameter_traffic, diameter_peer_fsm, diameter_watchdog diameter_traffic must be loaded first.
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-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-27Merge branch 'anders/diameter/hardening/OTP-11721' into maintAnders Svensson
* anders/diameter/hardening/OTP-11721: Simplify example server Make example server answer unsupported requests with 3001 Make example code quiet Don't count messages on arbitrary keys Replace traffic-related log reports with no-op function calls
2014-05-26Do best-effort decode of Failed-AVPAnders Svensson
Commit 4ce2d3a6 (diameter-1.4.2, OTP-11007) disabled the decode of values in Failed-AVP components since any error caused the decode of Failed-AVP itself to fail. This is less than useful since (1) we should be able to decode it given that we've sent it (modulo mangling on the way to the peer and back), and (2) it's not unheard of to examine Failed-AVP to see what the peer objected to. This commits adds a best-effort decode: decode if possible, otherwise not, using the same abuse of the process dictionary as commit bbdb027c.
2014-05-26Fix handling of AVP length errors (5014) in unknown AVPsAnders Svensson
Commit 4ce2d3a6 added the insertion of a single bit into binary AVP data to induce an encode error in the case of a header length that pointed past the available bytes: a 5014 = DIAMETER_INVALID_AVP_LENGTH error. Commit 838856b fixed this for stringish Diameter types, but both commits neglected the case in which the offending AVP isn't known to the dictionary in question. Unless the AVP was regarded as erroneous for other reasons (eg. an M-bit resulting in 5001) it would be happily be packed into an 'AVP' field. If it was regarded as an error, the record could be passed back to diameter_codec:pack_avp/1, and if the record contained header data then there was no clause to deal with the unpleasantry. Deal with it by having the dictionary module strip the extra bit and flag the AVP as 5014, and by having diameter_codec handle any extra bit coming from an dictionary compiled against an old diameter_gen. An old dictionary won't detect 5014 however, so dictionaries should be recompiled. Change most of the guards in diameter_codec from is_bitstring/1 to is_binary/1. What's being passed to the decode functions are binaries received other the network. The only case in which a non-binary bitstring is when we've placed an extra bit there ourselves. (Modulo someone doing something they shouldn't.)
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-26Merge branch 'anders/diameter/dpr/OTP-11938' into maintAnders Svensson
* anders/diameter/dpr/OTP-11938: Ensure watchdog dies with transport if DPA was sent
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/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-25Fix diameter_sctp function_clauseAnders Svensson
Introduced in commit ed6395a6. The {stream, Id} transport_data set upon reception is passed back to us by default when receiving the answer to a request message, so even capabilities exchange failed.
2014-05-23Ensure watchdog dies with transport if DPA was sentAnders Svensson
A DPR/DPA exchange should always cause the watchdog process in question to die with the transport, so that a subsequent connection with the same peer doesn't result in a 3 x DWR/DWA exchange. Commit 5903d6db saw to this for the sending of DPR but neglected the corresponding problem for DPA. In the case of sending DPR (the aforementioned commit), note that there's no distinction between receiving DPA as expected and not: the watchdog dies with the transport regardless. diameter_watchdog must be loaded first at upgrade.
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.