anchor.diff:  %% type.
   
   pack_AVP(_, #diameter_avp{data = {5014 = RC, Data}} = Avp, _, _, Acc) ->
  -    {Rec, Failed} = Acc,
  -    {Rec, [{RC, Avp#diameter_avp{data = Data}} | Failed]};
  +    {Rec, AM, Failed} = Acc,
  +    {Rec, AM, [{RC, Avp#diameter_avp{data = Data}} | Failed]};
   
   pack_AVP(Name, Avp, Opts, Mod, Acc) ->
  -    pack_arity(Name, pack_arity(Name, Opts, Mod, Avp), Avp, Mod, Acc).
  -
  -%% pack_arity/5
  -
  -pack_arity(_, 0, #diameter_avp{is_mandatory = M} = Avp, _, Acc) ->
  -    {Rec, Failed} = Acc,
  -    {Rec, [{if M -> 5001; true -> 5008 end, Avp} | Failed]};
  -
  -pack_arity(_, Arity, Avp, Mod, Acc) ->
  -    pack(Arity, 'AVP', Avp, Mod, Acc).
  +    Arity = pack_arity(Name, Opts, Mod, Avp),
  +    if 0 == Arity ->
  +            M = Avp#diameter_avp.is_mandatory,
  +            {Rec, AM, Failed} = Acc,
  +            {Rec, AM, [{if M -> 5001; true -> 5008 end, Avp} | Failed]};
  +       true ->
  +            pack(Arity, 'AVP', Avp, Mod, Acc)
  +    end.
  +
  +%% 3588:
  +%%
  +%%   DIAMETER_AVP_UNSUPPORTED           5001
  +%%      The peer received a message that contained an AVP that is not
  +%%      recognized or supported and was marked with the Mandatory bit.  A
  +%%      Diameter message with this error MUST contain one or more Failed-
  +%%      AVP AVP containing the AVPs that caused the failure.
  +%%
  +%%   DIAMETER_AVP_NOT_ALLOWED           5008
  +%%      A message was received with an AVP that MUST NOT be present.  The
  +%%      Failed-AVP AVP MUST be included and contain a copy of the
  +%%      offending AVP.
  +
  +%% pack_arity/4
   
   %% Give Failed-AVP special treatment since (1) it'll contain any
   %% unrecognized mandatory AVP's and (2) the RFC 3588 grammar failed to
  
positive.code: 
  %% decode_error/7
  
  decode_error(Name, [_ | Rec], _, #{failed_avp := true} = Opts, Mod, Avp, Acc) ->
      decode_AVP(Name, Avp#diameter_avp{value = Rec}, Opts, Mod, Acc);
  
  decode_error(Name, _, _, #{failed_avp := true} = Opts, Mod, Avp, Acc) ->
  
negative.code: %% DIAMETER_INVALID_AVP_LENGTH (5014). A module specified to a
  %% @custom_types tag in a dictionary file can also raise an error of
  %% this form.
  rc({'DIAMETER', 5014 = RC, _}, #diameter_avp{name = AvpName} = A, Opts, Mod) ->
      {RC, A#diameter_avp{data = Mod:empty_value(AvpName, Opts)}};
  
  %% 3588:
  %%
  