[erlang-questions] Fwd: Bug fix for DWR handling in R16B02

Sharmila Pillai <>
Tue Nov 26 15:20:10 CET 2013


Dear OTP team,
I sent this to erlang-patches but doesn't look like it got circulated. Hope
this helps someone.

regards,
Sharmila.

---------- Forwarded message ----------
From: Sharmila Pillai <>
Date: Mon, Nov 25, 2013 at 8:16 PM
Subject: Bug fix for DWR handling in R16B02
To: 


Hi,

We were testing our PCRF implementation using the diameter stack and found
that DWRs did not have a corresponding DWA.
This I found was because the Hop-by-hop identifier and End-to-end
identifier in the diameter_header weren't echoed back in a DWA (reference:
http://tools.ietf.org/html/rfc3588#section-3) but a new locally generated
one was being sent. Patch below fixes the problem.


$ diff diameter_watchdog.erl ~/temp/diameter_watchdog.erl
465,468c465,479
<     Seq = diameter_session:sequence(Mask),
<     Hdr = #diameter_header{version = ?DIAMETER_VERSION,
<                            end_to_end_id = Seq,
<                            hop_by_hop_id = Seq},
---
>     encode(undefined, Msg, Mask, Dict).
>
> encode(Req_pkt, Msg, Mask, Dict) ->
>     Hdr = case Req_pkt of
>               undefined ->
>                   Seq = diameter_session:sequence(Mask),
>                   #diameter_header{version = ?DIAMETER_VERSION,
>                                    end_to_end_id = Seq,
>                                    hop_by_hop_id = Seq};
>               #diameter_packet{header = #diameter_header{hop_by_hop_id =
H2H,
>                                                          end_to_end_id =
E2E}} ->
>                   #diameter_header{version = ?DIAMETER_VERSION,
>                                    end_to_end_id = E2E,
>                                    hop_by_hop_id = H2H}
>           end,
551c562
<     send(TPid, {send, encode(dwa(Pkt), Mask, Dict0)}),
---
>     send(TPid, {send, encode(Pkt, dwa(Pkt), Mask, Dict0)}),
795c806,808
< dwa(#diameter_packet{header = H, errors = Es}) ->
---
> dwa(#diameter_packet{header = #diameter_header{hop_by_hop_id = H2H,
>                                                end_to_end_id = E2E} = H,
>                      errors = Es}) ->


best wishes,
Sharmila.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131126/1ce8fb0c/attachment.html>


More information about the erlang-questions mailing list