diff options
author | Anders Svensson <[email protected]> | 2014-05-27 09:00:40 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2014-05-27 09:00:40 +0200 |
commit | 316fe2a30714b9eb87e0d11f6bdbbd1eb9fefdc1 (patch) | |
tree | 14601c07ecb5101af0d15a3ad36db9b7db004270 /lib/diameter/include/diameter_gen.hrl | |
parent | 44fc88d806af0b4a5c861e3501d210a8c574533b (diff) | |
parent | 58a74f2b6b6bd604d60fa8dca347cdd4ad2e4a3b (diff) | |
download | otp-316fe2a30714b9eb87e0d11f6bdbbd1eb9fefdc1.tar.gz otp-316fe2a30714b9eb87e0d11f6bdbbd1eb9fefdc1.tar.bz2 otp-316fe2a30714b9eb87e0d11f6bdbbd1eb9fefdc1.zip |
Merge branch 'anders/diameter/5014/OTP-11946' into maint
* anders/diameter/5014/OTP-11946:
Fix handling of AVP length errors (5014) in unknown AVPs
Add testcases that send unknown AVPs with a bad AVP Length
Diffstat (limited to 'lib/diameter/include/diameter_gen.hrl')
-rw-r--r-- | lib/diameter/include/diameter_gen.hrl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/diameter/include/diameter_gen.hrl b/lib/diameter/include/diameter_gen.hrl index 319ad5a783..ebc10b8918 100644 --- a/lib/diameter/include/diameter_gen.hrl +++ b/lib/diameter/include/diameter_gen.hrl @@ -412,6 +412,23 @@ pack_avp(_, Arity, Avp, Acc) -> %% pack_AVP/3 +%% Length failure was induced because of a header/payload length +%% mismatch. The AVP Length is reset to match the received data if +%% this AVP is encoded in an answer message, since the length is +%% computed. +%% +%% Data is a truncated header if command_code = undefined, otherwise +%% payload bytes. The former is padded to the length of a header if +%% the AVP reaches an outgoing encode in diameter_codec. +%% +%% RFC 6733 says that an AVP returned with 5014 can contain a minimal +%% payload for the AVP's type, but in this case we don't know the +%% type. + +pack_AVP(_, #diameter_avp{data = <<0:1, Data/binary>>} = Avp, Acc) -> + {Rec, Failed} = Acc, + {Rec, [{5014, Avp#diameter_avp{data = Data}} | Failed]}; + pack_AVP(Name, #diameter_avp{is_mandatory = M} = Avp, Acc) -> case pack_arity(Name, M) of 0 -> |