Skip to content

Commit

Permalink
inet_dns: fix tsig algname encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
jimdigriz committed Oct 30, 2023
1 parent 1d083f0 commit 80acc76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/kernel/src/inet_dns.erl
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,11 @@ encode_data(Comp, _, ?S_CAA, Data)->
encode_data(Comp, _, ?S_TSIG, Data)->
{AlgName,Now,Fudge,MAC,OriginalId,Error,OtherData} = Data,
%% Bypass name compression (RFC 8945, section 4.2)
{AlgNameEncoded,_} = encode_name(gb_trees:empty(), 0, AlgName),
AlgNameEncoded = encode_algname(AlgName),
{AlgNameEncoded1,_} = encode_name(gb_trees:empty(), 0, AlgNameEncoded),
MACSize = byte_size(MAC),
OtherLen = byte_size(OtherData),
DataB = <<AlgNameEncoded/binary,
DataB = <<AlgNameEncoded1/binary,
Now:48, Fudge:16, MACSize:16, MAC:MACSize/binary,
OriginalId:16, Error:16,
OtherLen:16, OtherData:OtherLen/binary>>,
Expand Down

0 comments on commit 80acc76

Please sign in to comment.