Skip to content

Commit

Permalink
Reject transport=udp;protocol=diameter at DiameterURI encode
Browse files Browse the repository at this point in the history
Both RFC 3588 and 6733 disallow the combination. Make its encode fail.
  • Loading branch information
Anders Svensson committed Mar 24, 2015
1 parent b7d8668 commit 35f5640
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/diameter/src/base/diameter_types.erl
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,12 @@
is_integer(PN),
0 =< PN,
(T == tcp orelse T == sctp orelse T == udp),
(P == diameter orelse P == radius orelse P == 'tacacs+') ->
(P == diameter orelse P == radius orelse P == 'tacacs+'),
(P /= diameter orelse T /= udp) ->
#diameter_uri{port = PN0,
transport = T0,
protocol = P0}
= #diameter_uri{},
iolist_to_binary([atom_to_list(Type), "://", DN,
":", integer_to_list(PN),
";transport=", atom_to_list(T),
Expand Down
11 changes: 9 additions & 2 deletions lib/diameter/test/diameter_codec_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,15 @@ values('DiameterURI') ->
Tr <- ["" | [";transport=" ++ X
|| X <- ["tcp", "sctp", "udp"]]],
Pr <- ["" | [";protocol=" ++ X
|| X <- ["diameter","radius","tacacs+"]]]],
[]};
|| X <- ["diameter","radius","tacacs+"]]],
Tr /= ";transport=udp"
orelse (Pr /= ";protocol=diameter" andalso Pr /= "")],
["aaa://diameter.se;transport=udp;protocol=diameter",
"aaa://diameter.se;transport=udp",
"aaa://:3868",
"aaax://diameter.se",
"aaa://diameter.se;transport=tcpx",
"aaa://diameter.se;transport=tcp;protocol=diameter "]};

values(T)
when T == 'IPFilterRule';
Expand Down

0 comments on commit 35f5640

Please sign in to comment.