Skip to content

Sort DNS MX and SRV records by priority#6206

Open
shblue21 wants to merge 1 commit into
eclipse-vertx:masterfrom
shblue21:fix/dns-record-priority-order
Open

Sort DNS MX and SRV records by priority#6206
shblue21 wants to merge 1 commit into
eclipse-vertx:masterfrom
shblue21:fix/dns-record-priority-order

Conversation

@shblue21

@shblue21 shblue21 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #6205

Motivation:

MX and SRV lookups should return records in DNS priority order, with lower priority values first, instead of preserving the DNS answer order.

This change sorts MX and SRV results by priority and decodes MX/SRV numeric fields as unsigned 16-bit values. It also adds regression tests and updates the resolveSRV() Javadoc.

Conformance:

I Have signed the ECA

@vietj vietj added this to the 5.2.0 milestone Jun 18, 2026
Comment thread vertx-core/src/test/java/io/vertx/tests/dns/DNSTest.java Outdated
Comment thread vertx-core/src/test/java/io/vertx/tests/dns/DNSTest.java Outdated
Comment thread vertx-core/src/main/java/io/vertx/core/dns/impl/DnsClientImpl.java Outdated
@shblue21

shblue21 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for review. I pushed the updates.

@shblue21 shblue21 force-pushed the fix/dns-record-priority-order branch from 0bed27f to 59a98b5 Compare June 18, 2026 11:41
@vietj

vietj commented Jun 18, 2026

Copy link
Copy Markdown
Member

@shblue21 can you make it a single commit that follows the commit message format that describes the motivation and outline the changes ?

@shblue21 shblue21 force-pushed the fix/dns-record-priority-order branch from 59a98b5 to 3a97c54 Compare June 18, 2026 13:03
@shblue21

Copy link
Copy Markdown
Contributor Author

Thanks, I squashed the commits into one and updated the commit message.

Motivation:

MX and SRV lookups should return records in DNS priority order, with lower priority values first, instead of preserving the DNS answer order.

Changes:

Sort MX and SRV records returned by queryAll by ascending priority.
Decode MX priority and SRV priority/weight fields as unsigned 16-bit values.
Add regression tests and update the resolveSRV Javadoc.

Signed-off-by: Jihun Kim <shblue21@naver.com>
@shblue21 shblue21 force-pushed the fix/dns-record-priority-order branch from 3a97c54 to c4f80df Compare June 19, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DnsClient does not sort MX and SRV records by priority

2 participants