aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/doc/src
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-02-12 17:46:38 +0100
committerAnders Svensson <[email protected]>2013-02-16 22:46:45 +0100
commit61b9efd8b4cf35dce44ec2fefd26339d2d20cb3c (patch)
tree2157f468910dd1df0233ab710dccaf5dd4e655e8 /lib/diameter/doc/src
parentdf2189c22f7ca7660496e46322d8b825e9f28ba3 (diff)
downloadotp-61b9efd8b4cf35dce44ec2fefd26339d2d20cb3c.tar.gz
otp-61b9efd8b4cf35dce44ec2fefd26339d2d20cb3c.tar.bz2
otp-61b9efd8b4cf35dce44ec2fefd26339d2d20cb3c.zip
Be less brutal in setting Result-Code/Failed-AVP
When receiving a request for which errors have been detected during decode, diameter previously used the errors list in the decoded diameter_packet record to unconditionally set Result-Code and Failed-AVP in the outgoing answer. It wasn't particularly delicate in doing so however and would happily set a 5xxx Result-Code even if a handle_request callback returned an answer-message, leading to an encode error. This behaviour became even less endearing as of commit ac452e28, which made it possible to handle_request to take place even for protocol errors. (ie. When a callback typically should return an answer-message.) This commit fixes the behaviour by only setting a value that's appropriate for the answer in question, either a 3xxx or a 5xxx, depending on if the answer's an answer-message or not. It also allows handle_request to prevent diameter from setting anything by setting errors = false in a returned diameter_packet. Ideally it should have been errors = [] but the empty list is the default value for the errors field and changing the default (ideally there shouldn't have been one) would require recompilation of all modules including diameter.hrl: choose the less attractive 'false' to avoid such backwards incompatibility. The request reception is also refactored somewhat to shorten some call chains.
Diffstat (limited to 'lib/diameter/doc/src')
-rw-r--r--lib/diameter/doc/src/diameter_app.xml21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/diameter/doc/src/diameter_app.xml b/lib/diameter/doc/src/diameter_app.xml
index f4db625c71..5c23c9d683 100644
--- a/lib/diameter/doc/src/diameter_app.xml
+++ b/lib/diameter/doc/src/diameter_app.xml
@@ -13,7 +13,7 @@
<header>
<copyright>
-<year>2011</year><year>2012</year>
+<year>2011</year><year>2013</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -509,14 +509,15 @@ Otherwise it contains the record representing the request as outlined
in &dict;.</p>
<p>
-The <c>errors</c> field specifies any Result-Code's identifying errors
-that were encountered in decoding the request.
-In this case diameter will set both Result-Code and
-Failed-AVP AVP's in a returned
-answer &message; before sending it to the peer:
-the returned &message; need only set any other required AVP's.
-Note that the errors detected by diameter are all of the 5xxx series
-(Permanent Failures).
+The <c>errors</c> field specifies any results codes identifying errors
+found while decoding the request.
+This is used to set Result-Code and/or Failed-AVP in a returned
+answer unless the callback returns a <c>#diameter_packet{}</c>
+whose <c>errors</c> field is set to either a non-empty list of its
+own, in which case this list is used instead, or the atom <c>false</c>
+to disable any setting of Result-Code and Failed-AVP.
+Note that the errors detected by diameter are of the 3xxx
+and 5xxx series, Protocol Errors and Permanent Failures respectively.
The <c>errors</c> list is empty if the request has been received in
the relay application.</p>
@@ -558,8 +559,6 @@ where <c>Avps</c> sets the Origin-Host, Origin-Realm, the specified
Result-Code and (if the request sent one) Session-Id AVP's.</p>
<p>
-Note that &the_rfc; mandates that only answers with a 3xxx series
-Result-Code (protocol errors) may set the E bit.
Returning a non-3xxx value in a <c>protocol_error</c> tuple
will cause the request process in question to fail.</p>
</item>