Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dnssd] Fixed OT DNS API usage for Thread platform #26199

Merged

Conversation

kkasperczyk-no
Copy link
Contributor

Introduced several fixes to the Thread platform DNS implementation:

  • Added checking if memory allocation for DnsResult was successful and dispatching dedicated methods to inform upper layer in case of memory allocation failure
  • Added checking if DNS response for DNS resolve includes AAAA record. In case it doesn't the additional DNS query to obtain IPv6 address will be sent.
  • Added checking if DNS response for DNS browse includes SRV, TXT and AAAA records. In case it doesn't the additional DNS queries to obtain SRV + TXT, and AAAA records will be sent.

Fixes: #26101

@github-actions
Copy link

PR #26199: Size comparison from 65f075c to b09e520

Full report (1 build for cc32xx)
platform target config section 65f075c b09e520 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 643249 643249 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933224 933224 0 0.0
.debug_aranges 87792 87792 0 0.0
.debug_frame 302140 302140 0 0.0
.debug_info 20330829 20330829 0 0.0
.debug_line 2687904 2687904 0 0.0
.debug_loc 2838960 2838960 0 0.0
.debug_ranges 288072 288072 0 0.0
.debug_str 3042335 3042335 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104401 104401 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377963 377963 0 0.0
.symtab 256976 256976 0 0.0
.text 536728 536728 0 0.0

Copy link
Contributor

@LuDuda LuDuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Great work 👍

Introduced several fixes to the Thread platform DNS implementation:
* Added checking if memory allocation for DnsResult was successful
and dispatching dedicated methods to inform upper layer in case
of memory allocation failure
* Added checking if DNS response for DNS resolve includes AAAA
record. In case it doesn't the additional DNS query to obtain
IPv6 address will be sent.
* Added checking if DNS response for DNS browse includes SRV, TXT
and AAAA records. In case it doesn't the additional DNS queries
to obtain SRV + TXT, and AAAA records will be sent.
@kkasperczyk-no kkasperczyk-no force-pushed the dns_resolve_thread_fix branch from b09e520 to a9a0d29 Compare April 24, 2023 05:49
@github-actions
Copy link

PR #26199: Size comparison from de0dfcf to a9a0d29

Full report (1 build for cc32xx)
platform target config section de0dfcf a9a0d29 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 643249 643249 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933224 933224 0 0.0
.debug_aranges 87792 87792 0 0.0
.debug_frame 302140 302140 0 0.0
.debug_info 20330829 20330829 0 0.0
.debug_line 2687904 2687904 0 0.0
.debug_loc 2838960 2838960 0 0.0
.debug_ranges 288072 288072 0 0.0
.debug_str 3042335 3042335 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104401 104401 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377963 377963 0 0.0
.symtab 256976 256976 0 0.0
.text 536728 536728 0 0.0

Copy link

@abtink abtink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kkasperczyk-no.
Looks good overall. Couple of suggestions and questions below.

@github-actions github-actions bot added the lib label Apr 25, 2023
* Fixed error handling and potential memory leaks
* Moved handling resolve after browse from Thread platform
to Discovery_ImplPlatform.
@kkasperczyk-no kkasperczyk-no force-pushed the dns_resolve_thread_fix branch from 4b73c69 to 800f014 Compare April 25, 2023 12:02
@github-actions
Copy link

PR #26199: Size comparison from bcf1b80 to 800f014

Increases (1 build for cc32xx)
platform target config section bcf1b80 800f014 change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_info 19489249 19489250 1 0.0
Full report (1 build for cc32xx)
platform target config section bcf1b80 800f014 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 601114 601114 0 0.0
(read/write) 204132 204132 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197544 197544 0 0.0
.comment 206 206 0 0.0
.data 1468 1468 0 0.0
.debug_abbrev 956756 956756 0 0.0
.debug_aranges 103416 103416 0 0.0
.debug_frame 349704 349704 0 0.0
.debug_info 19489249 19489250 1 0.0
.debug_line 2678035 2678035 0 0.0
.debug_line_str 513 513 0 0.0
.debug_loc 33340 33340 0 0.0
.debug_loclists 1501882 1501882 0 0.0
.debug_ranges 4984 4984 0 0.0
.debug_rnglists 96008 96008 0 0.0
.debug_str 3024877 3024877 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104170 104170 0 0.0
.shstrtab 265 265 0 0.0
.stack 2048 2048 0 0.0
.strtab 477531 477531 0 0.0
.symtab 285936 285936 0 0.0
.text 494824 494824 0 0.0

* Fixed string copying by adding the exact size of data to copy
instead of relying on the max buffer size.
Copy link
Contributor

@bzbarsky-apple bzbarsky-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing this!

@bzbarsky-apple bzbarsky-apple merged commit fa3563a into project-chip:master Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thread implementation of ChipDnssdResolve does not follow the DNS-SD spec, breaks with some DNS servers
6 participants