aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src
AgeCommit message (Collapse)Author
2017-09-03Merge branch 'anders/diameter/decode_format/OTP-14511' into maintAnders Svensson
* anders/diameter/decode_format/OTP-14511: Map less in traffic suite Fix decode_format doc oversights Rename decode_format false to none Tweak {decode_format, false} semantics Fix dialyzer spec
2017-09-03Merge branch 'anders/diameter/config_consistency/OTP-14555' into maintAnders Svensson
* anders/diameter/config_consistency/OTP-14555: Fix strict_arities blunder Fix minor error-handling blunder
2017-09-03Merge branch 'anders/diameter/Proxy-Info/OTP-9869' into maintAnders Svensson
* anders/diameter/Proxy-Info/OTP-9869: Fix handling of Proxy-Info in answers formulated by diameter
2017-09-03Merge branch 'anders/diameter/Experimental-Result/OTP-14511' into maintAnders Svensson
* anders/diameter/Experimental-Result/OTP-14511: Fix extraction of Experimental-Result for counter keys
2017-09-03Merge branch 'anders/diameter/performance/OTP-14521' into maintAnders Svensson
* anders/diameter/performance/OTP-14521: Rename variable Fix decode of too many generic AVPs Enumerate AVPs in diameter_avp.index (again)
2017-09-03Merge branch 'anders/diameter/sctp/OTP-10889' into maintAnders Svensson
* anders/diameter/sctp/OTP-10889: Send unordered on all outbound diameter_sctp streams Delay rotation of diameter_sctp outbound streams Exercise unordered delivery in traffic suite Use unordered delivery on a lone outbound stream in diameter_sctp
2017-09-01Rename decode_format false to noneAnders Svensson
Which reads better and makes it easier to distinguish this false from others.
2017-09-01Tweak {decode_format, false} semanticsAnders Svensson
Represent the decoded message by its atom-valued name in diameter_packet.msg, which makes trace much more readable. A diameter_avp.value is untouched (ie. undefined): the AVP name is already in the name field.
2017-09-01Fix dialyzer specAnders Svensson
Which dialyzer hasn't noticed.
2017-09-01Merge branch 'anders/diameter/config_consistency/OTP-14555' into ↵Anders Svensson
anders/diameter/decode_format/OTP-14511 * anders/diameter/config_consistency/OTP-14555: Fix strict_arities blunder Fix minor error-handling blunder Let strict_mbit and incoming_maxlen be configured per transport Let a service configure default transport options Rename type evaluable -> eval Document transport_opt() strict_capx Rename transport_opt() capx_strictness to strict_capx
2017-09-01Fix strict_arities blunderAnders Svensson
Remove value from the merged map, not from the maps being merged. Bundled in commit 5f3becad.
2017-08-31Fix minor error-handling blunderAnders Svensson
Leading to this admonition from dialyzer: diameter_config.erl:670: The variable No can never match since previous clauses completely covered the type 'ok' The throw was caught, but resulted in an error return without the intended information.
2017-08-31Fix handling of Proxy-Info in answers formulated by diameterAnders Svensson
RFC 6733 says this: 6.2. Diameter Answer Processing When a request is locally processed, the following procedures MUST be applied to create the associated answer, in addition to any additional procedures that MAY be discussed in the Diameter application defining the command: ... o Any Proxy-Info AVPs in the request MUST be added to the answer message, in the same order they were present in the request. This wasn't done when a handle_request callback returned a Result-Code in an 'answer-message' or protocol_error tuple, causing diameter itself to construct the answer message. This form of answer is just a convenience, since the callback can always return an answer that it constructs itself.
2017-08-31Fix extraction of Experimental-Result for counter keysAnders Svensson
The introduction of decode_format in commit 722fa415 (and then 55e65b26) meant the value was not necessarily the intended tuple.
2017-08-31Rename variableAnders Svensson
It's no longer the AVP name as of the parent commit, but the name of the field/member the value will be stored in. Typically the AVP name, but possibly 'AVP'.
2017-08-31Fix decode of too many generic AVPsAnders Svensson
That is, when the arity of an 'AVP' field has an upper bound. This shouldn't happen in practice, but if an AVP is known but its name not explicit in the message grammar then its count was confused with that of AVPs packed into the 'AVP' field.
2017-08-31Enumerate AVPs in diameter_avp.index (again)Anders Svensson
Commit 96cd627a changed the way the index field was used, but the enumeration is used in at least one known application (as a pointer from elements of diameter_packet.errors to elements of diameter_packet.avps) and the motivation for the change is questionable: the lookup that was avoided was unnecessary given that it was already performed in incrementing a counter. Revert to enumerating as before in the non-relay case, but not in the relay case since there's no corresponding usecase.
2017-08-29Send unordered on all outbound diameter_sctp streamsAnders Svensson
There's no reason for sending ordered since request handling is concurrent: different processes handling incoming requests can't know in which order they were received on the transport, and different processes sending requests can't know the order in which they're sent.
2017-08-29Delay rotation of diameter_sctp outbound streamsAnders Svensson
For the same reason as unordered delivery is delayed in the grandparent commit. Delivery is ordered only within a stream, so until a second message is received from the peer, there's no guarantee that a second outgoing request won't be received before the initial capablities exchange message. Rotation begins upon reception of a second message from the peer, messages being sent on stream 0 until then.
2017-08-29Merge branch 'anders/diameter/config_consistency/OTP-14555' into maintAnders Svensson
* anders/diameter/config_consistency/OTP-14555: Let strict_mbit and incoming_maxlen be configured per transport Let a service configure default transport options Rename type evaluable -> eval
2017-08-29Merge branch 'anders/diameter/upgrade/OTP-14552' into maintAnders Svensson
* anders/diameter/upgrade/OTP-14552: Fix compatibility of remote send
2017-08-29Merge branch 'anders/diameter/strict_capx/OTP-14546' into maintAnders Svensson
* anders/diameter/strict_capx/OTP-14546: Document transport_opt() strict_capx Rename transport_opt() capx_strictness to strict_capx
2017-08-29Merge branch 'anders/diameter/performance/OTP-14521' into maintAnders Svensson
* anders/diameter/performance/OTP-14521: Fix influence of decode_format on service events Work around more common_test woe
2017-08-29Merge branch 'anders/diameter/loopback_any/OTP-14544' into maintAnders Svensson
* anders/diameter/loopback_any/OTP-14544: Use loopback/any config in examples suite Handle loopback/any as local address in diameter_tcp/sctp
2017-08-29Merge branch 'anders/diameter/caseless/OTP-14535' into maintAnders Svensson
* anders/diameter/caseless/OTP-14535: Replace calls to inet_parse(3) Fix regexp match of accept tuple in diameter_tcp/sctp
2017-08-29Use unordered delivery on a lone outbound stream in diameter_sctpAnders Svensson
RFC 6733 say the below about head-of-line blocking and SCTP, the suggestion of unordered sending being new compared to the RFC 3588. Until now, all delivery in diameter_sctp has been ordered, and roundrobin over available streams unless the user passes a stream identifier in an outgoing diameter_packet record. This commit changes this to use unordered delivery when there's only a single outbound stream to choose from. The special case at capabilities exchange is handled by only starting to send unordered after the second message from the peer has been received. (First message after capabilities exchange, as the RFC probably means.) The special case at DPR isn't handled, since there's no knowing the order in which a peer will answer: a node that sends DPR while it has other requests outstanding can't expect that the latter will be answered before DPR, even if delivery is ordered since incoming requests are handled concurrently. If it wants a guarantee then it simply has to wait for answers before sending DPR. A user can force all delivery to be unordered by specifying {sctp_default_send_params, #sctp_sndrcvinfo{flags = [unordered]}} as a config option to diameter_sctp, but in this case there's no handling of a request being sent directly after CEA since there's no ordered flag to override the default. RFC 6733: 2.1.1. SCTP Guidelines Diameter messages SHOULD be mapped into SCTP streams in a way that avoids head-of-the-line (HOL) blocking. Among different ways of performing the mapping that fulfill this requirement it is RECOMMENDED that a Diameter node send every Diameter message (request or response) over stream zero with the unordered flag set. However, Diameter nodes MAY select and implement other design alternatives for avoiding HOL blocking such as using multiple streams with the unordered flag cleared (as originally instructed in RFC 3588). On the receiving side, a Diameter entity MUST be ready to receive Diameter messages over any stream, and it is free to return responses over a different stream. This way, both sides manage the available streams in the sending direction, independently of the streams chosen by the other side to send a particular Diameter message. These messages can be out-of-order and belong to different Diameter sessions. Out-of-order delivery has special concerns during a connection establishment and termination. When a connection is established, the responder side sends a CEA message and moves to R-Open state as specified in Section 5.6. If an application message is sent shortly after the CEA and delivered out-of-order, the initiator side, still in Wait-I-CEA state, will discard the application message and close the connection. In order to avoid this race condition, the receiver side SHOULD NOT use out-of-order delivery methods until the first message has been received from the initiator, proving that it has moved to I-Open state. To trigger such a message, the receiver side could send a DWR immediately after sending a CEA. Upon reception of the corresponding DWA, the receiver side should start using out-of- order delivery methods to counter the HOL blocking. Another race condition may occur when DPR and DPA messages are used. Both DPR and DPA are small in size; thus, they may be delivered to the peer faster than application messages when an out-of-order delivery mechanism is used. Therefore, it is possible that a DPR/DPA exchange completes while application messages are still in transit, resulting in a loss of these messages. An implementation could mitigate this race condition, for example, using timers, and wait for a short period of time for pending application level messages to arrive before proceeding to disconnect the transport connection. Eventually, lost messages are handled by the retransmission mechanism described in Section 5.5.4.
2017-08-28Fix influence of decode_format on service eventsAnders Svensson
Decoded CER/CEA messages are passed in events messages that can be subscribed to using diameter:subscribe/1. A configured decode_format was not reflected in these, messages always being passed as records. Clarify that strict_arities only applies to message callbacks.
2017-08-25Let strict_mbit and incoming_maxlen be configured per transportAnders Svensson
Since these can make sense per peer. The remaining service-only options either belong there or make little sense being configured per transport.
2017-08-25Let a service configure default transport optionsAnders Svensson
Only a default spawn_opt has been possible to configure, but there's no reason why most others should need to be configured per transport. Those options that still only make sense on a transport are transport_module/config (because of the semantics of multiple values), applications/capabilities (since these override service options), and private (since it's only to allow user-specific options in a backwards compatible way).
2017-08-24Rename type evaluable -> evalAnders Svensson
Export the old type as a synonym for backwards compatability. The name evaluable is a bit too awkward.
2017-08-24Rename transport_opt() capx_strictness to strict_capxAnders Svensson
To follow the naming of options like strict_mbit and more. Still accept capx_strictness since this is known to be used. Introduced in commit e4f28f3b.
2017-08-23Fix compatibility of remote sendAnders Svensson
By changing the definition of the request record, commit f489c0d5 broke sending an outgoing request over a peer connection terminated on a remote node running an older version of diameter. The modified fields aren't even used on the remote node, so simply reintroduce one of the fields so that the size of the tuple is unchanged.
2017-08-19Handle loopback/any as local address in diameter_tcp/sctpAnders Svensson
The support is implied by documentation, but wasn't handled in code. Be consistent in retrieving the address from the sock rather than the configuration, and in accepting both ip and ifaddr for a local address.
2017-08-18Merge branch 'anders/diameter/performance/OTP-14521' into maintAnders Svensson
* anders/diameter/performance/OTP-14521: Work around unexpected common_test behaviour Randomly skip groups in traffic suite Randomly disable traffic counters in traffic suite Add service_opt() traffic_counters Fix type spec Split AVPs at decode Avoid unnecessary copying of binaries in diameter_tcp Don't update diameter_tcp state unnecessarily Don't update diameter_tcp state unnecessarily Simplify extraction of incoming Diameter messages in diameter_tcp Restructure/simplify message reception in diameter_peer_fsm Sleep randomly at the start of (parallel) traffic testcases Fix ct return value in traffic suite Fix type spec Optimize sub-binaries Optimize sub-binaries Count AVPs in #diameter_avp.index Don't extract options unnecessarily at encode Redo message decode as a single pass
2017-08-18Merge branch 'anders/diameter/5009/OTP-14512' into maintAnders Svensson
* anders/diameter/5009/OTP-14512: Use relaxed arity checks in traffic suite Be forgiving of non-list values at encode Add service_opt() strict_arities Fix detection of 5009 errors Test Result-Code 5009 in traffic suite
2017-08-18Merge branch 'anders/diameter/codec/OTP-14511' into maintAnders Svensson
* anders/diameter/codec/OTP-14511: (26 commits) Limit SCTP testing in traffic suite Increase init_per_group timetrap in traffic suite Add diameter_util:eprof/1 for test Don't search forms unnecessarily in diameter_exprecs parse transform Increase init_per_suite timetrap in traffic suite Don't count AVPs unnecessarily at encode Test decode_format record_from_map in traffic suite Tweak limiting of testcases in traffic suite Don't take length of AVP lists unnecessarily at encode Tweak map-valued decode Rearrange group names in traffic suite Randomly wrap answers in diameter_packet in transport suite Don't exercise client/server encoding independently in traffic suite Add decode_format record_from_map Rename record_decode -> decode_format Create fewer client connections in traffic suite Test record_decode in traffic suite Map answers to maps in traffic suite Test map encoding in traffic suite Let messages and grouped AVPs be decoded to lists ...
2017-08-15Replace calls to inet_parse(3)Anders Svensson
With the documented calls to inet(3).
2017-08-15Fix regexp match of accept tuple in diameter_tcp/sctpAnders Svensson
Matching of remote addresses when accepting connections in a listening transport was case-sensitive, causing the semantics to change as a consequence of 95ebfa0b, which made inet:ntoa/1 return lowercase.
2017-08-10Don't search forms unnecessarily in diameter_exprecs parse transformAnders Svensson
The forms being extracted are in the head of the split.
2017-08-10Add service_opt() traffic_countersAnders Svensson
To be able to disable the counting of messages for which application callbacks take place. Messages sent/handled by diameter itself are always counted.
2017-08-10Fix type specAnders Svensson
That dialyzer hasn't noticed is broken.
2017-08-10Split AVPs at decodeAnders Svensson
Despite what the Efficiency Guide says about match being more efficient, split_binary appears to be slightly faster. (Although this one extraction is a drop in the bucket.) Binary optimizations aren't an issue during decode.
2017-08-10Avoid unnecessary copying of binaries in diameter_tcpAnders Svensson
Since messages are accumulated by appending binaries as of three commits back, the accumulated binary is prone to being copied, as discussed in the Efficiency Guide. Matching the Message Length header as bytes are being accumulated is one cause of this, so work around it by splitting the binary and extracting the length without a match. This doesn't feel like something that should be necessary: that matching a binary would cause an append to copy isn't obvious. The first attempt at simplifying the accumulation was simply to append an incoming binary to the current fragment, match against <<_, Len:24, _/binary>> to extract the length, and then test if there are enough bytes for a message. This lead to horrible performance (response times for 2 MB messages approximately 100 times worse than previously), and it wasn't at all obvious that the reason was the accumulated binary being copied with each append as a result of the match. Using split_binary avoids the match context that forces the copying.
2017-08-10Don't update diameter_tcp state unnecessarilyAnders Svensson
Not with each setopts to re-activate the socket.
2017-08-10Don't update diameter_tcp state unnecessarilyAnders Svensson
Only reset the fragment after all messages have been extracted.
2017-08-10Simplify extraction of incoming Diameter messages in diameter_tcpAnders Svensson
Appending to a binary is efficient, so just append message fragments Only match out the length once per message since doing so for every packet from TCP causes the binary to be copied.
2017-08-10Restructure/simplify message reception in diameter_peer_fsmAnders Svensson
Create less garbage.
2017-08-10Fix type specAnders Svensson
That dialyzer hasn't noticed is broken.
2017-08-09Merge branch 'anders/diameter/message_cb/OTP-14486' into maintAnders Svensson
* anders/diameter/message_cb/OTP-14486: Add simple message_cb to example server Fix inappropriate message callbacks
2017-08-09Merge branch 'anders/diameter/20.0/shared_transport/OTP-14011' into maintAnders Svensson
* anders/diameter/20.0/shared_transport/OTP-14011: Don't assume nodes are eternally connected when sharing transport