Skip to content

Commit 2358eea

Browse files
committed
Correctly sort records with a priority. Closes #2843
1 parent edf46fe commit 2358eea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pdns/signingpipe.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ ChunkedSigningPipe::~ChunkedSigningPipe()
109109
namespace {
110110
bool dedupLessThan(const DNSResourceRecord& a, const DNSResourceRecord &b)
111111
{
112-
if(tie(a.content, a.ttl) < tie(b.content, b.ttl))
113-
return true;
114-
if(a.qtype.getCode() == QType::MX || a.qtype.getCode() == QType::SRV)
115-
return a.priority < b.priority;
116-
return false;
112+
uint16_t aprio = 0, bprio = 0;
113+
if (a.qtype.getCode() == QType::MX || a.qtype.getCode() == QType::SRV)
114+
aprio = a.priority;
115+
if (b.qtype.getCode() == QType::MX || b.qtype.getCode() == QType::SRV)
116+
bprio = b.priority;
117+
return tie(a.content, a.ttl, aprio) < tie(b.content, b.ttl, bprio);
117118
}
118119

119120
bool dedupEqual(const DNSResourceRecord& a, const DNSResourceRecord &b)

0 commit comments

Comments
 (0)