aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-10-14 12:56:45 +0200
committerAnders Svensson <[email protected]>2017-10-14 13:31:23 +0200
commitdb59b2076a49ae31c7ba03dd0e4f248a48c7e9b1 (patch)
treeb893763848a43c6dd40c62428fa9a16a08975571 /lib/diameter
parentf9dab31aa65ee08d5d550d09bdf81d0c5744eb8d (diff)
downloadotp-db59b2076a49ae31c7ba03dd0e4f248a48c7e9b1.tar.gz
otp-db59b2076a49ae31c7ba03dd0e4f248a48c7e9b1.tar.bz2
otp-db59b2076a49ae31c7ba03dd0e4f248a48c7e9b1.zip
Fix error handling when decoding an AVP with an alternate dictionary
The options map wasn't updated after the AVP was identified, with the resulting consequences for M-bit interpretation.
Diffstat (limited to 'lib/diameter')
-rw-r--r--lib/diameter/src/base/diameter_gen.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/diameter/src/base/diameter_gen.erl b/lib/diameter/src/base/diameter_gen.erl
index d0142c568d..93ebe57685 100644
--- a/lib/diameter/src/base/diameter_gen.erl
+++ b/lib/diameter/src/base/diameter_gen.erl
@@ -574,15 +574,17 @@ dec_AVP(Dicts, Data, Name, Mod, Fmt, Opts, #diameter_avp{code = Code,
%% Try to decode an AVP in the first alternate dictionary that defines
%% it.
-dec_AVP([Dict | Rest], Data, Name, Mod, Fmt, Opts, Code, Vid, Avp) ->
+dec_AVP([Dict | Rest], Data, Name, Mod, Fmt, Opts0, Code, Vid, Avp) ->
case Dict:avp_name(Code, Vid) of
- {AvpName, Type} ->
+ {AvpName, Type} = NameT ->
A = Avp#diameter_avp{name = AvpName,
type = Type},
- #{failed_avp := Failed} = Opts,
+ #{failed_avp := Failed}
+ = Opts
+ = setopts(NameT, Name, Avp#diameter_avp.is_mandatory, Opts0),
dec(Data, Name, AvpName, Type, Mod, Dict, Fmt, Failed, Opts, A);
_ ->
- dec_AVP(Rest, Data, Name, Mod, Fmt, Opts, Code, Vid, Avp)
+ dec_AVP(Rest, Data, Name, Mod, Fmt, Opts0, Code, Vid, Avp)
end;
dec_AVP([], _, _, _, _, _, _, _, Avp) ->