aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/app/diameter_service.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-09-22 19:59:03 +0200
committerAnders Svensson <[email protected]>2011-09-26 20:12:33 +0200
commit4a64f3a7d64e3aae364508054c0c1a9273db2301 (patch)
tree2ca852fde37213393c2bde0a785d05e408202ba3 /lib/diameter/src/app/diameter_service.erl
parent97f3a064f27843a9f825210c1c7a27075b7b3ad7 (diff)
downloadotp-4a64f3a7d64e3aae364508054c0c1a9273db2301.tar.gz
otp-4a64f3a7d64e3aae364508054c0c1a9273db2301.tar.bz2
otp-4a64f3a7d64e3aae364508054c0c1a9273db2301.zip
Fix bugs in sending of answer-message replies
3001 (DIAMETER_COMMAND_UNSUPPORTED) was not sent since the decode placed the AVP list in the errors field rather than the avps field of the diameter_packet, causing the subsequent encode to fail. Session-Id was also set improperly, causing encode to fail even in this case.
Diffstat (limited to 'lib/diameter/src/app/diameter_service.erl')
-rw-r--r--lib/diameter/src/app/diameter_service.erl28
1 files changed, 7 insertions, 21 deletions
diff --git a/lib/diameter/src/app/diameter_service.erl b/lib/diameter/src/app/diameter_service.erl
index 63b0649dc4..01a125fdc7 100644
--- a/lib/diameter/src/app/diameter_service.erl
+++ b/lib/diameter/src/app/diameter_service.erl
@@ -1971,24 +1971,20 @@ reply(Msg, Dict, TPid, #diameter_packet{errors = [H|_] = Es} = Pkt) ->
%% make_reply_packet/2
+%% Binaries and header/avp lists are sent as-is.
make_reply_packet(Bin, _)
when is_binary(Bin) ->
#diameter_packet{bin = Bin};
-
make_reply_packet([#diameter_header{} | _] = Msg, _) ->
#diameter_packet{msg = Msg};
+%% Otherwise a reply message clears the R and T flags and retains the
+%% P flag. The E flag will be set at encode.
make_reply_packet(Msg, #diameter_packet{header = ReqHdr}) ->
- #diameter_header{end_to_end_id = EId,
- hop_by_hop_id = Hid,
- is_proxiable = P}
- = ReqHdr,
-
- Hdr = #diameter_header{version = ?DIAMETER_VERSION,
- end_to_end_id = EId,
- hop_by_hop_id = Hid,
- is_proxiable = P,
- is_retransmitted = false},
+ Hdr = ReqHdr#diameter_header{version = ?DIAMETER_VERSION,
+ is_request = false,
+ is_error = undefined,
+ is_retransmitted = false},
#diameter_packet{header = Hdr,
msg = Msg}.
@@ -2126,16 +2122,6 @@ answer_message({OH, OR, RC}, Avps) ->
session_id(Code, Vid, Avps)
when is_list(Avps) ->
try
- {value, #diameter_avp{} = Avp} = find_avp(Code, Vid, Avps),
- Avp
- catch
- error: _ ->
- []
- end;
-
-session_id(Code, Vid, Avps)
- when is_list(Avps) ->
- try
{value, #diameter_avp{data = D}} = find_avp(Code, Vid, Avps),
[{'Session-Id', [?BASE:avp(decode, D, 'Session-Id')]}]
catch