Groupcast: IANA address corrected.#71641
Groupcast: IANA address corrected.#71641rcasallas-silabs wants to merge 1 commit intoproject-chip:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new static method, MakeIPv6WellKnownMulticast, to the IPAddress class for constructing the ff05::fa multicast address and updates PeerAddress::Groupcast to use it. Feedback identifies a missing type initialization for the IPAddress object, which is required for SDK validity, and suggests simplifying the implementation by removing redundant htonl(0) calls and unnecessary literal suffixes.
| IPAddress IPAddress::MakeIPv6WellKnownMulticast() | ||
| { | ||
| IPAddress addr; | ||
| addr.Addr[0] = htonl(0xFF050000ul); | ||
| addr.Addr[1] = htonl(0); | ||
| addr.Addr[2] = htonl(0); | ||
| addr.Addr[3] = htonl(0xFAul); | ||
| return addr; | ||
| } |
There was a problem hiding this comment.
The IPAddress object addr is not initialized with a type. In the CHIP SDK, IPAddress objects must have their Type field set (e.g., to IPAddressType::kIPv6) to be valid for operations like comparison or string conversion. Additionally, the implementation can be simplified by removing redundant htonl(0) calls. Note that unnecessary type suffixes (e.g., 'U' for unsigned) should be avoided for literals to improve readability.
IPAddress IPAddress::MakeIPv6WellKnownMulticast()
{
IPAddress addr;
addr.Type = IPAddressType::kIPv6;
addr.Addr[0] = htonl(0xFF050000);
addr.Addr[1] = 0;
addr.Addr[2] = 0;
addr.Addr[3] = htonl(0xFA);
return addr;
}References
- Avoid adding unnecessary type suffixes (e.g., 'u' for unsigned) to literals if they are not strictly required by the compiler or a macro and could hinder readability.
|
PR #71641: Size comparison from 5f28762 to 086d57f Full report (34 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
|
| * | ||
| * @return The constructed IP address. | ||
| */ | ||
| static IPAddress MakeIPv6WellKnownMulticast(); |
There was a problem hiding this comment.
Just a preference:
| static IPAddress MakeIPv6WellKnownMulticast(); | |
| static IPAddress MakeIPv6MatterIANAMulticastAddr(); |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #71641 +/- ##
==========================================
- Coverage 54.40% 54.40% -0.01%
==========================================
Files 1582 1582
Lines 108395 108398 +3
Branches 13384 13384
==========================================
Hits 58976 58976
- Misses 49419 49422 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
The Groupcast address is wrong, the correct value is FF05::FA.
Related issues
Issue #71631: Groupcast in chip SDK is using IANA address wrong.
Testing
UNTESTED
Readability checklist
The checklist below will help the reviewer finish PR review in time and keep the
code readable:
descriptive
“When in Rome…”
rule (coding style)
See: Pull Request Guidelines