Date: Mon, 4 Mar 2013 15:56:42 +0100
Subject: Tweak okay -> suspect config
Make it just a number of timeouts, without a new DWR being sent.
---
lib/diameter/doc/src/diameter.xml | 8 ++--
lib/diameter/src/base/diameter_watchdog.erl | 18 ++++-----
lib/diameter/test/diameter_watchdog_SUITE.erl | 55 +++++++++++++++------------
3 files changed, 42 insertions(+), 39 deletions(-)
(limited to 'lib/diameter')
diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml
index 75e95a9a3d..8e9ec06ff9 100644
--- a/lib/diameter/doc/src/diameter.xml
+++ b/lib/diameter/doc/src/diameter.xml
@@ -1132,10 +1132,10 @@ corresponding timeout (see below) or all fail.
Specifies configuration that alters the behaviour of the watchdog
state machine.
On key okay, the non-negative number of answered DWR
-messages required before transitioning from REOPEN to OKAY.
-On key suspect, the positive number of unanswered DWR messages
-before transitioning from OKAY to SUSPECT, or 0 to never make this
-transition.
+messages before transitioning from REOPEN to OKAY.
+On key suspect, the number of watchdog timeouts before
+transitioning from OKAY to SUSPECT when DWR is unanswered, or 0 to
+not make the transition.
Defaults to [{okay, 3}, {suspect, 1}].
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index 0b32974efe..82ca603cf3 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -49,6 +49,8 @@
-define(IS_NATURAL(N), (is_integer(N) andalso 0 =< N)).
+-define(CHOOSE(B,T,F), if (B) -> T; true -> F end).
+
-record(config,
{suspect = 1 :: non_neg_integer(), %% OKAY -> SUSPECT
okay = 3 :: non_neg_integer()}). %% REOPEN -> OKAY
@@ -61,7 +63,7 @@
%% {M,F,A} -> integer() >= 0
num_dwa = 0 :: -1 | non_neg_integer(),
%% number of DWAs received in reopen,
- %% or to send in okay before moving to suspect
+ %% or number of timeouts before okay -> suspect
%% end PCB
parent = self() :: pid(), %% service process
transport :: pid() | undefined, %% peer_fsm process
@@ -424,7 +426,7 @@ transition({'DOWN', _, process, TPid, _Reason},
#watchdog{transport = TPid,
status = T}
= S) ->
- set_watchdog(S#watchdog{status = case T of initial -> T; _ -> down end,
+ set_watchdog(S#watchdog{status = ?CHOOSE(initial == T, T, down),
pending = false,
transport = undefined});
@@ -668,9 +670,10 @@ timeout(#watchdog{status = okay,
case N of
1 ->
S#watchdog{status = suspect};
- _ -> %% non-standard
- send_watchdog(S#watchdog{pending = false,
- num_dwa = decr(N)})
+ 0 -> %% non-standard: never move to suspect
+ S;
+ N -> %% non-standard: more timeouts before moving
+ S#watchdog{num_dwa = N-1}
end;
%% SUSPECT Timer expires CloseConnection()
@@ -725,11 +728,6 @@ timeout(#watchdog{status = T} = S)
T == down ->
restart(S).
-decr(0 = N) ->
- N;
-decr(N) ->
- N-1.
-
%% restart/1
restart(#watchdog{transport = undefined} = S) ->
diff --git a/lib/diameter/test/diameter_watchdog_SUITE.erl b/lib/diameter/test/diameter_watchdog_SUITE.erl
index 82244a1c7f..704bf110c7 100644
--- a/lib/diameter/test/diameter_watchdog_SUITE.erl
+++ b/lib/diameter/test/diameter_watchdog_SUITE.erl
@@ -89,16 +89,23 @@
-define(INFO(T), #diameter_event{info = T}).
%% Receive an event message from diameter.
--define(EVENT(T),
- apply(fun() -> %% apply to not bind T_
- receive #diameter_event{info = T = T_} ->
- log_event(T_)
- end
+-define(EVENT(T), %% apply to not bind T_
+ apply(fun() ->
+ receive ?INFO(T = T_) -> log_event(T_) end
end,
[])).
%% Receive a watchdog event.
-define(WD_EVENT(Ref), log_wd(element(4, ?EVENT({watchdog, Ref, _, _, _})))).
+-define(WD_EVENT(Ref, Ms),
+ apply(fun() ->
+ receive ?INFO({watchdog, Ref, _, T_, _}) ->
+ log_wd(T_)
+ after Ms ->
+ false
+ end
+ end,
+ [])).
%% Log to make failures identifiable.
-define(LOG(T), ?LOG("~p", [T])).
@@ -376,8 +383,8 @@ tpid(Ref, [[{ref, Ref},
%% # suspect/1
%% ===========================================================================
-%% Configure transports to require a set number of watchdogs before
-%% moving from OKAY to SUSPECT.
+%% Configure transports to require a set number of watchdog timeouts
+%% before moving from OKAY to SUSPECT.
suspect(_) ->
[] = run([[abuse, [suspect, N]] || N <- [0,1,3]]).
@@ -394,19 +401,21 @@ suspect(TRef, true, SvcName, _) ->
{okay, _} = ?WD_EVENT(TRef);
suspect(TRef, false, SvcName, 0) -> %% SUSPECT disabled
- %% Wait 2+ watchdogs and see that two unanswered watchdogs have
- %% been sent.
- [2,0,0,0] = receive
- ?INFO({watchdog, TRef, _, _, _} = T) -> T
- after 28000 ->
- wd_counts(SvcName)
- end;
+ %% Wait 2+ watchdogs and see that only one watchdog has been sent.
+ false = ?WD_EVENT(TRef, 28000),
+ [1,0,0,0] = wd_counts(SvcName);
suspect(TRef, false, SvcName, N) ->
- {okay, suspect} = ?WD_EVENT(TRef),
- [N,0,0,0] = wd_counts(SvcName),
- {suspect, down} = ?WD_EVENT(TRef),
- [N,0,0,0] = wd_counts(SvcName).
+ %% Check that no watchdog transition takes place within N+
+ %% watchdogs ...
+ false = ?WD_EVENT(TRef, N*10000+8000),
+ [1,0,0,0] = wd_counts(SvcName),
+ %% ... but that the connection then becomes suspect ...
+ {okay, suspect} = ?WD_EVENT(TRef, 10000),
+ [1,0,0,0] = wd_counts(SvcName),
+ %% ... and goes down.
+ {suspect, down} = ?WD_EVENT(TRef, 18000),
+ [1,0,0,0] = wd_counts(SvcName).
%% abuse/1
@@ -470,13 +479,9 @@ ok(TRef, SvcName, Down, 0) ->
%% Connection comes up without watchdog exchange.
{Down, okay} = ?WD_EVENT(TRef),
[1,0,0,0] = wd_counts(SvcName),
- %% Wait 2+ watchdog timeout to see that the connection stays up and
- %% two watchdogs are exchanged.
- ok = receive ?INFO({watchdog, TRef, _, _, _} = T) ->
- T
- after 28000 ->
- ok
- end,
+ %% Wait 2+ watchdog timeouts to see that the connection stays up
+ %% and two watchdogs are exchanged.
+ false = ?WD_EVENT(TRef, 28000),
[3,0,0,2] = wd_counts(SvcName);
ok(TRef, SvcName, Down, N) ->
--
cgit v1.2.3
From da15b3c5fdc9ff96b8d02f4620c879418648d45c Mon Sep 17 00:00:00 2001
From: Anders Svensson
Date: Mon, 11 Mar 2013 16:02:01 +0100
Subject: Update appup
---
lib/diameter/src/base/diameter.appup.src | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
(limited to 'lib/diameter')
diff --git a/lib/diameter/src/base/diameter.appup.src b/lib/diameter/src/base/diameter.appup.src
index 2ce89579ff..c3c7fe9a38 100644
--- a/lib/diameter/src/base/diameter.appup.src
+++ b/lib/diameter/src/base/diameter.appup.src
@@ -28,7 +28,12 @@
{"1.2.1", [{restart_application, diameter}]},
{"1.3", [{restart_application, diameter}]}, %% R15B03
{"1.3.1", [{restart_application, diameter}]},
- {"1.4", [{restart_application, diameter}]} %% R16A
+ {"1.4", [{restart_application, diameter}]}, %% R16A
+ {"1.4.1", [{load_module, diameter_reg}, %% R16B
+ {load_module, diameter_stats},
+ {load_module, diameter_service},
+ {load_module, diameter_watchdog},
+ {load_module, diameter}]}
],
[
{"0.9", [{restart_application, diameter}]},
@@ -39,6 +44,7 @@
{"1.2.1", [{restart_application, diameter}]},
{"1.3", [{restart_application, diameter}]},
{"1.3.1", [{restart_application, diameter}]},
- {"1.4", [{restart_application, diameter}]}
+ {"1.4", [{restart_application, diameter}]},
+ {"1.4.1", [{restart_application, diameter}]}
]
}.
--
cgit v1.2.3
From 359bd293d2a3ab65bac48a3fe14fe8b33beffebd Mon Sep 17 00:00:00 2001
From: Anders Svensson
Date: Fri, 15 Mar 2013 18:37:56 +0100
Subject: Deal with RFC 6733 change to Vendor-Specific-Application-Id
RFC 6733 has changed the arity of Vendor-Id in this Grouped AVP, from 1*
in RFC 3588 to 1 in RFC 6773. This impacts the generated dictionary
modules: Vendor-Id is expected to be list-valued in the 3588 dictionary,
integer-valued in the 6733 dictionary. This, in turn, breaks the
independence of capabilities configuration on a service or transport
from the dictionary that will be used to encode an outgoing CER or CEA.
This commit fixes this by massaging any Vendor-Specific-Application-Id
config as appropriate when constructing CER or CEA for a given
dictionary.
---
lib/diameter/src/base/diameter_capx.erl | 45 ++++++++++++++++++++++++++++++-
lib/diameter/test/diameter_capx_SUITE.erl | 26 +++++++++++++++---
2 files changed, 67 insertions(+), 4 deletions(-)
(limited to 'lib/diameter')
diff --git a/lib/diameter/src/base/diameter_capx.erl b/lib/diameter/src/base/diameter_capx.erl
index 715b15628c..9a443fead0 100644
--- a/lib/diameter/src/base/diameter_capx.erl
+++ b/lib/diameter/src/base/diameter_capx.erl
@@ -172,7 +172,50 @@ ipaddr(A) ->
bCER(#diameter_caps{} = Rec, Dict) ->
Values = lists:zip(Dict:'#info-'(diameter_base_CER, fields),
tl(tuple_to_list(Rec))),
- Dict:'#new-'(diameter_base_CER, Values).
+ Dict:'#new-'(diameter_base_CER, [{K, map(K, V, Dict)}
+ || {K,V} <- Values]).
+
+%% map/3
+%%
+%% Deal with differerences in common dictionary AVP's to make changes
+%% transparent in service/transport config. In particular, one
+%% annoying difference between RFC 3588 and RFC 6733.
+%%
+%% RFC 6773 changes the definition of Vendor-Specific-Application-Id,
+%% giving Vendor-Id arity 1 instead of 3588's 1*. This causes woe
+%% since the corresponding dictionaries expect different values for a
+%% 'Vendor-Id': a list for 3588, an integer for 6733.
+
+map('Vendor-Specific-Application-Id', L, Dict) ->
+ Rec = Dict:'#new-'('diameter_base_Vendor-Specific-Application-Id', []),
+ Def = Dict:'#get-'('Vendor-Id', Rec),
+ [vsa(V, Def) || V <- L];
+map(_, V, _) ->
+ V.
+
+vsa({_, N, _, _} = Rec, [])
+ when is_integer(N) ->
+ setelement(2, Rec, [N]);
+
+vsa({_, [N], _, _} = Rec, undefined)
+ when is_integer(N) ->
+ setelement(2, Rec, N);
+
+vsa([_|_] = L, Def) ->
+ [vid(T, Def) || T <- L];
+
+vsa(T, _) ->
+ T.
+
+vid({'Vendor-Id' = K, N}, [])
+ when is_integer(N) ->
+ {K, [N]};
+
+vid({'Vendor-Id' = K, [N]}, undefined) ->
+ {K, N};
+
+vid(T, _) ->
+ T.
%% rCER/3
%%
diff --git a/lib/diameter/test/diameter_capx_SUITE.erl b/lib/diameter/test/diameter_capx_SUITE.erl
index a4e4195a19..6fe6682571 100644
--- a/lib/diameter/test/diameter_capx_SUITE.erl
+++ b/lib/diameter/test/diameter_capx_SUITE.erl
@@ -34,6 +34,7 @@
%% testcases
-export([start/1,
+ vendor_id/1,
start_services/1,
add_listeners/1,
s_no_common_application/1,
@@ -69,7 +70,7 @@
-define(HOST(Name), Name ++ "." ++ ?REALM).
%% Config for diameter:start_service/2.
--define(SERVICE(Name),
+-define(SERVICE,
[{'Origin-Realm', ?REALM},
{'Host-IP-Address', [?ADDR]},
{'Vendor-Id', 12345},
@@ -103,6 +104,7 @@ suite() ->
[{timetrap, {seconds, 60}}].
all() -> [start,
+ vendor_id,
start_services,
add_listeners]
++ [{group, D, P} || D <- ?DICTS, P <- [[], [parallel]]]
@@ -156,9 +158,27 @@ tc() ->
start(_Config) ->
ok = diameter:start().
+%% Ensure that both integer and list-valued vendor id's can be
+%% configured in a 'Vendor-Specific-Application-Id, the arity having
+%% changed between RFC 3588 and RFC 6733.
+vendor_id(_Config) ->
+ [] = ?util:run([[fun vid/1, V] || V <- [1, [1], [1,2], x]]).
+
+vid(V) ->
+ RC = diameter:start_service(make_ref(),
+ [{'Vendor-Specific-Application-Id',
+ [[{'Vendor-Id', V}]]}
+ | ?SERVICE]),
+ vid(V, RC).
+
+vid(x, {error, _}) ->
+ ok;
+vid(_, ok) ->
+ ok.
+
start_services(_Config) ->
- ok = diameter:start_service(?SERVER, ?SERVICE(?SERVER)),
- ok = diameter:start_service(?CLIENT, ?SERVICE(?CLIENT)).
+ ok = diameter:start_service(?SERVER, ?SERVICE),
+ ok = diameter:start_service(?CLIENT, ?SERVICE).
%% One server that responds only to base accounting, one that responds
%% to both this and the common application. Share a common service just
--
cgit v1.2.3
From 14ac8fe40ca70e06aca5aecf3b6c26559303b0fd Mon Sep 17 00:00:00 2001
From: Anders Svensson
Date: Sun, 17 Mar 2013 15:22:33 +0100
Subject: Update appup, vsn -> 1.4.1.1
---
lib/diameter/src/base/diameter.appup.src | 1 +
lib/diameter/vsn.mk | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
(limited to 'lib/diameter')
diff --git a/lib/diameter/src/base/diameter.appup.src b/lib/diameter/src/base/diameter.appup.src
index c3c7fe9a38..359f434941 100644
--- a/lib/diameter/src/base/diameter.appup.src
+++ b/lib/diameter/src/base/diameter.appup.src
@@ -33,6 +33,7 @@
{load_module, diameter_stats},
{load_module, diameter_service},
{load_module, diameter_watchdog},
+ {load_module, diameter_capx},
{load_module, diameter}]}
],
[
diff --git a/lib/diameter/vsn.mk b/lib/diameter/vsn.mk
index 98e719c50a..757f29a32e 100644
--- a/lib/diameter/vsn.mk
+++ b/lib/diameter/vsn.mk
@@ -18,5 +18,5 @@
# %CopyrightEnd%
APPLICATION = diameter
-DIAMETER_VSN = 1.4.1
+DIAMETER_VSN = 1.4.1.1
APP_VSN = $(APPLICATION)-$(DIAMETER_VSN)$(PRE_VSN)
--
cgit v1.2.3
From 16da847bc882eaaf69dffd5cdaaeddf26592ca8a Mon Sep 17 00:00:00 2001
From: Anders Svensson
Date: Tue, 19 Mar 2013 10:31:45 +0100
Subject: Minor capx suite fix
---
lib/diameter/test/diameter_capx_SUITE.erl | 1 +
1 file changed, 1 insertion(+)
(limited to 'lib/diameter')
diff --git a/lib/diameter/test/diameter_capx_SUITE.erl b/lib/diameter/test/diameter_capx_SUITE.erl
index 6fe6682571..9e6619ecdd 100644
--- a/lib/diameter/test/diameter_capx_SUITE.erl
+++ b/lib/diameter/test/diameter_capx_SUITE.erl
@@ -130,6 +130,7 @@ end_per_group(_, _) ->
end_per_testcase(N, _)
when N == start;
+ N == vendor_id;
N == start_services;
N == add_listeners;
N == remove_listeners;
--
cgit v1.2.3
From e173bc1b28453f0edb4863677f3c730b3d7a9f91 Mon Sep 17 00:00:00 2001
From: Erlang/OTP
Date: Mon, 18 Mar 2013 14:21:06 +0100
Subject: Prepare release
---
lib/diameter/doc/src/notes.xml | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
(limited to 'lib/diameter')
diff --git a/lib/diameter/doc/src/notes.xml b/lib/diameter/doc/src/notes.xml
index d63e2021c8..2daf84b0d4 100644
--- a/lib/diameter/doc/src/notes.xml
+++ b/lib/diameter/doc/src/notes.xml
@@ -42,6 +42,43 @@ first.
+Diameter 1.4.1.1
+
+ Fixed Bugs and Malfunctions
+
+ -
+
+ Fix broken Vendor-Specific-Application-Id configuration.
+
+ RFC 6733 changed the definition of this Grouped AVP,
+ changing the arity of Vendor-Id from 1* to 1. A component
+ Vendor-Id can now be either list- or integer-valued in
+ service and transport configuration, allowing it to be
+ used with both RFC 3588 and RFC 6733 dictionaries.
+
+ Own Id: OTP-10942
+
+
+
+
+
+ Improvements and New Features
+
+ -
+
+ Add transport_opt() watchdog_config to allow non-standard
+ behaviour of the watchdog state machine.
+
+ This can be useful during test but should not be used on
+ nodes that must conform to RFC 3539.
+
+ Own Id: OTP-10898
+
+
+
+
+
+
Diameter 1.4.1
Fixed Bugs and Malfunctions
--
cgit v1.2.3