aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_codec.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-03-20 02:18:06 +0100
committerAnders Svensson <[email protected]>2015-03-24 11:02:05 +0100
commitb8a7df45c9e57a832f7db9b9b875b31d0ab7d29c (patch)
tree31c582bcb62cdfa0a1fbf51b47741af4eb94b521 /lib/diameter/src/base/diameter_codec.erl
parent35f564094033ea2eb4c5b01d0d0b1c0d629ea5b1 (diff)
downloadotp-b8a7df45c9e57a832f7db9b9b875b31d0ab7d29c.tar.gz
otp-b8a7df45c9e57a832f7db9b9b875b31d0ab7d29c.tar.bz2
otp-b8a7df45c9e57a832f7db9b9b875b31d0ab7d29c.zip
Adapt to changed DiameterURI defaults in RFC 6733
Despite claims of full backwards compatibility, the text of RFC 6733 changes the interpretation of unspecified values in a DiameterURI. In particular, 3588 says that the default port and transport are 3868 and sctp respectively, while 6733 says it's either 3868/tcp (aaa) or 5658/tcp (aaas). The 3588 defaults were used regardless, but now use them only if the common dictionary is diameter_gen_base_rfc3588. The 6733 defaults are used otherwise. This kind of change in the standard can lead to interop problems, since a node has to know which RFC its peer is following to know that it will properly interpret missing URI components. Encode of a URI includes all components to avoid such confusion. That said, note that the defaults in the diameter_uri record have *not* been changed. This avoids breaking code that depends on them, but the risk is that such code sends inappropriate values. The record defaults may be changed in a future release, to force values to be explicitly specified.
Diffstat (limited to 'lib/diameter/src/base/diameter_codec.erl')
-rw-r--r--lib/diameter/src/base/diameter_codec.erl9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index cc0953f5d3..15a4c5e86f 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -81,6 +81,13 @@ setopts(Opts)
setopt({string_decode = K, false = B}) ->
setopt(K, B);
+%% Regard anything but the generated RFC 3588 dictionary as modern.
+%% This affects the interpretation of defaults during the decode
+%% of values of type DiameterURI, this having changed from RFC 3588.
+%% (So much for backwards compatibility.)
+setopt({common_dictionary, diameter_gen_base_rfc3588}) ->
+ setopt(rfc, 3588);
+
setopt(_) ->
ok.
@@ -91,6 +98,8 @@ getopt(Key) ->
case get({diameter, Key}) of
undefined when Key == string_decode ->
true;
+ undefined when Key == rfc ->
+ 6733;
V ->
V
end.