<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/diameter/include, branch OTP-17.1</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>Merge branch 'anders/diameter/hardening/OTP-11721' into maint</title>
<updated>2014-05-28T06:35:54+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-05-28T06:35:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=495b44babd659247f674ef88d50440e10891e138'/>
<id>495b44babd659247f674ef88d50440e10891e138</id>
<content type='text'>
* anders/diameter/hardening/OTP-11721:
  Change answer_errors default from report to discard
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* anders/diameter/hardening/OTP-11721:
  Change answer_errors default from report to discard
</pre>
</div>
</content>
</entry>
<entry>
<title>Change answer_errors default from report to discard</title>
<updated>2014-05-27T07:52:21+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-05-27T07:45:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=631522514dbd409dbb789103b54bd81c879aff34'/>
<id>631522514dbd409dbb789103b54bd81c879aff34</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Do best-effort decode of Failed-AVP</title>
<updated>2014-05-26T15:51:54+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-05-22T22:24:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=c2c00fdd4de1b8883e47ec1b5b048659ef033302'/>
<id>c2c00fdd4de1b8883e47ec1b5b048659ef033302</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix handling of AVP length errors (5014) in unknown AVPs</title>
<updated>2014-05-26T15:14:59+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-05-23T16:28:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=58a74f2b6b6bd604d60fa8dca347cdd4ad2e4a3b'/>
<id>58a74f2b6b6bd604d60fa8dca347cdd4ad2e4a3b</id>
<content type='text'>
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.)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.)
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace traffic-related log reports with no-op function calls</title>
<updated>2014-05-26T11:52:04+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-05-22T09:01:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=0058430352420a8c0dc053900f108e7086f52fad'/>
<id>0058430352420a8c0dc053900f108e7086f52fad</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'anders/diameter/17.0_release/OTP-11605'</title>
<updated>2014-04-07T08:21:29+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-04-07T08:21:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=87371fb20e08a50621900c77b2ec4aeecdad18a7'/>
<id>87371fb20e08a50621900c77b2ec4aeecdad18a7</id>
<content type='text'>
* anders/diameter/17.0_release/OTP-11605:
  Fix diameter.hrl comment typos
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* anders/diameter/17.0_release/OTP-11605:
  Fix diameter.hrl comment typos
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix diameter.hrl comment typos</title>
<updated>2014-04-07T08:19:38+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-04-07T07:39:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=558317c4a559afb26caba7f57a854d49020ea6cb'/>
<id>558317c4a559afb26caba7f57a854d49020ea6cb</id>
<content type='text'>
A Diameter Header Command Code is 24 bits, not 8, and an Application-ID
is 32 bits, not 24.

Thanks to Austin Aigbe for pointing it out.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A Diameter Header Command Code is 24 bits, not 8, and an Application-ID
is 32 bits, not 24.

Thanks to Austin Aigbe for pointing it out.
</pre>
</div>
</content>
</entry>
<entry>
<title>Be lenient with the M-bit in Grouped AVPs</title>
<updated>2014-02-24T16:27:02+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2014-02-06T18:25:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=bbdb027ccf78207ea911e67f3d1b9edcb6cf3ca0'/>
<id>bbdb027ccf78207ea911e67f3d1b9edcb6cf3ca0</id>
<content type='text'>
RFC 6733 says this, in 4.4:

  Receivers of a Grouped AVP that does not have the 'M' (mandatory) bit
  set and one or more of the encapsulated AVPs within the group has the
  'M' (mandatory) bit set MAY simply be ignored if the Grouped AVP itself
  is unrecognized. The rule applies even if the encapsulated AVP with its
  'M' (mandatory) bit set is further encapsulated within other sub-groups,
  i.e., other Grouped AVPs embedded within the Grouped AVP.

The first sentence is mangled but take it to mean this:

  An unrecognized AVP of type Grouped that does not set the 'M' bit MAY
  be ignored even if one of its encapsulated AVPs sets the 'M' bit.

This is a bit of a non-statement since if the AVP is unrecognized then
its type is unknown. We therefore don't know that its data bytes contain
encapsulated AVPs, so can't but ignore any of those that set the M-bit.
Doing anything else when the type *is* known would be inconsistent.

OTP-11087 (commit 066544fa) caused the M-bit on any unrecognized AVP to
be regarded as an error, unrecognized being taken to mean "not
explicitly defined as a member of its container". (That is, an AVP that
can't be packed into a dedicated record field, which is slightly
stronger than "not defined".) This fixed the original intention for
top-level AVPs but broke the required leniency for Grouped AVPs whose
type is known. This commit restores the leniency.

Note that dictionary files need to be recompiled for the commit to have
effect.

Thanks to Rory McKeown for reporting the problem.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
RFC 6733 says this, in 4.4:

  Receivers of a Grouped AVP that does not have the 'M' (mandatory) bit
  set and one or more of the encapsulated AVPs within the group has the
  'M' (mandatory) bit set MAY simply be ignored if the Grouped AVP itself
  is unrecognized. The rule applies even if the encapsulated AVP with its
  'M' (mandatory) bit set is further encapsulated within other sub-groups,
  i.e., other Grouped AVPs embedded within the Grouped AVP.

The first sentence is mangled but take it to mean this:

  An unrecognized AVP of type Grouped that does not set the 'M' bit MAY
  be ignored even if one of its encapsulated AVPs sets the 'M' bit.

This is a bit of a non-statement since if the AVP is unrecognized then
its type is unknown. We therefore don't know that its data bytes contain
encapsulated AVPs, so can't but ignore any of those that set the M-bit.
Doing anything else when the type *is* known would be inconsistent.

OTP-11087 (commit 066544fa) caused the M-bit on any unrecognized AVP to
be regarded as an error, unrecognized being taken to mean "not
explicitly defined as a member of its container". (That is, an AVP that
can't be packed into a dedicated record field, which is slightly
stronger than "not defined".) This fixed the original intention for
top-level AVPs but broke the required leniency for Grouped AVPs whose
type is known. This commit restores the leniency.

Note that dictionary files need to be recompiled for the commit to have
effect.

Thanks to Rory McKeown for reporting the problem.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix recognition of 5001 on mandatory AVP's</title>
<updated>2013-05-29T15:16:41+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2013-05-14T11:11:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=066544fa0c85e2603f5f0ebfdd8b2f07a8e4a4a7'/>
<id>066544fa0c85e2603f5f0ebfdd8b2f07a8e4a4a7</id>
<content type='text'>
An AVP setting the M-bit was not regarded as erroneous if it was defined
in the dictionary in question and its container (message or Grouped AVP)
had an 'AVP' field. It's now regarded as a 5001 error (AVP_UNSUPPORTED),
as in the case that the AVP is not defined.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An AVP setting the M-bit was not regarded as erroneous if it was defined
in the dictionary in question and its container (message or Grouped AVP)
had an 'AVP' field. It's now regarded as a 5001 error (AVP_UNSUPPORTED),
as in the case that the AVP is not defined.
</pre>
</div>
</content>
</entry>
<entry>
<title>Detect all 5005 (MISSING_AVP) errors and don't reverse errors</title>
<updated>2013-05-17T13:16:03+00:00</updated>
<author>
<name>Anders Svensson</name>
<email>anders@erlang.org</email>
</author>
<published>2013-05-02T23:38:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=38a75600cbd5b51ae61921df78cc02348e563564'/>
<id>38a75600cbd5b51ae61921df78cc02348e563564</id>
<content type='text'>
The previous commit ensures that only one will be reported in an answer
message when diameter itself sets Result-Code/Failed-AVP.

The order of errors in #diameter_packet.errors is that in which they're
detected, not the reverse as previously.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous commit ensures that only one will be reported in an answer
message when diameter itself sets Result-Code/Failed-AVP.

The order of errors in #diameter_packet.errors is that in which they're
detected, not the reverse as previously.
</pre>
</div>
</content>
</entry>
</feed>
