Skip to content

Wrong call of add_service instead of add_service_type and other small fixes#374

Merged
ivmarkov merged 4 commits intoproject-chip:mainfrom
sysgrok:next
Feb 10, 2026
Merged

Wrong call of add_service instead of add_service_type and other small fixes#374
ivmarkov merged 4 commits intoproject-chip:mainfrom
sysgrok:next

Conversation

@ivmarkov
Copy link
Contributor

@ivmarkov ivmarkov commented Feb 10, 2026

The one really gross error fixed here is a one-liner:

  • I was calling service.add_service(answer, self.hostname, ttl_sec)?;
  • ... where I should've been calling service.add_service_type(answer, ttl_sec)?; instead.

A needle in a haystack to find basically.

(The others are compliance fixes that are nice to have, but not the end of the world.)

I must say, it was Opus 4.6 which found the needle in the haystack when I asked it to review the current implementation. So credit where credit it due.

The outcome is immediately noticeable.
Where the controller previously struggled for sometimes minutes to connect to our device, running multiple mDNS queries, it now immediately connects.

Phew!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ivmarkov, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses several issues within the mDNS implementation, primarily correcting a misnamed function call from add_service to add_service_type and refining how mDNS responses are handled. It also ensures that IP address records are consistently included as additional data in mDNS replies and adjusts the flush-bit behavior for certain PTR records to align with mDNS specifications.

Highlights

  • Corrected Service Type Handling: The add_service function call was replaced with add_service_type when responding to service type FQDN queries, ensuring correct mDNS record generation.
  • Ignored mDNS Responses: Added a check to prevent the mDNS responder from processing and replying to mDNS responses (where the QR bit is set), focusing only on actual queries.
  • Enhanced Additional Data Inclusion: Modified mDNS responses to consistently include IP address (IPS) records as additional data for various service and subtype queries.
  • Adjusted PTR Record Flush-Bit: Removed the flush-bit from PTR records for dns_sd_fqdn to accurately reflect that the responder is not the authoritative source for these records.
  • Improved Test Coverage: New test cases were introduced to validate the correct handling of PTR service type queries and to confirm that mDNS responses are properly ignored.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • rs-matter/src/transport/network/mdns/builtin/proto.rs
    • Added a check to ignore incoming mDNS messages that are responses (QR bit set) rather than queries.
    • Replaced service.add_service with service.add_service_type and added *ad |= AdditionalData::IPS when handling service type FQDN queries.
    • Included *ad |= AdditionalData::IPS when handling service subtype FQDN queries.
    • Removed dns_class_with_flush(Class::IN) and replaced it with Class::IN for dns_sd_fqdn PTR records, along with a clarifying comment.
    • Extended an existing test case with additional IP address answers.
    • Added test_ptr_service_type_query to verify PTR query responses for service types.
    • Added test_response_ignored to confirm that mDNS responses (QR=1) are not processed.
Activity
  • No specific activity (comments, reviews, progress) has been provided for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several important fixes and improvements to the mDNS implementation. It correctly handles PTR queries for service types by calling add_service_type instead of add_service, and ensures that mDNS responses are ignored, preventing response loops. Additionally, it properly manages the cache-flush bit for shared DNS-SD records and enhances responses by including IP address records in the additional data section. The inclusion of new tests to cover these changes is a great addition and significantly improves the robustness of the code. The changes are well-implemented. I have one minor suggestion to improve code style.

ivmarkov and others added 2 commits February 10, 2026 03:33
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ivmarkov ivmarkov requested a review from gmarcosb February 10, 2026 01:34
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions
Copy link

PR #374: Size comparison from 0893162 to 6c432ff

Full report (8 builds for (core), dimmable-light, onoff-light, onoff-light-bt, speaker)
platform target config section 0893162 6c432ff change % change
(core) riscv32imac-unknown-none-elf infodefmt-optz-ltofat FLASH 378316 378322 6 0.0
RAM 64712 64712 0 0.0
thumbv6m-none-eabi infodefmt-optz-ltofat FLASH 317792 317852 60 0.0
RAM 61240 61248 8 0.0
thumbv7em-none-eabi infodefmt-optz-ltofat FLASH 291236 291336 100 0.0
RAM 60732 60736 4 0.0
x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 811399 811159 -240 -0.0
RAM 64400 64400 0 0.0
dimmable-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1874160 1873984 -176 -0.0
RAM 46584 46584 0 0.0
onoff-light x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 1800928 1800624 -304 -0.0
RAM 46576 46576 0 0.0
onoff-light-bt x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 3113648 3114560 912 0.0
RAM 9304 9304 0 0.0
speaker x86_64-unknown-linux-gnu infologs-optz-ltofat FLASH 801088 801088 0 0.0
RAM 2832 2832 0 0.0

@ivmarkov ivmarkov merged commit d502046 into project-chip:main Feb 10, 2026
13 of 14 checks passed
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.

2 participants