mirror of
https://github.com/espressif/openthread.git
synced 2026-08-25 03:39:52 +00:00
[mle] update kAloc16ServiceEnd and add explicit ALOC16 range check (#11300)
This commit updates `kAloc16ServiceEnd` to `0xfc1f`, aligning it with recent changes in the Thread specification. The range `0xfc10-0xfc1f` is now used for service ALOC16 corresponding to the 16 service IDs, and the range `0xfc20-0xfc2f` is reserved for future use. It also updates the `NetworkData::Leader::AnycastLookup()` to explicitly check a given `aAloc16` against the defined ALOC16 ranges. This replaces the previous model, which assumed that ALOC16 ranges followed each other sequentially. While this assumption held true previously, the introduction of the reserved range disrupts this pattern. The explicit range check ensures correct behavior regardless of future changes, making it a safer and more robust approach.
This commit is contained in:
@@ -110,6 +110,12 @@ void TestNumUtils(void)
|
||||
u32 = 0xfff0000;
|
||||
VerifyOrQuit(ClampToUint16(u32) == 0xffff);
|
||||
|
||||
VerifyOrQuit(IsValueInRange<uint8_t>(5, 5, 10));
|
||||
VerifyOrQuit(IsValueInRange<uint8_t>(7, 5, 10));
|
||||
VerifyOrQuit(IsValueInRange<uint8_t>(10, 5, 10));
|
||||
VerifyOrQuit(!IsValueInRange<uint8_t>(4, 5, 10));
|
||||
VerifyOrQuit(!IsValueInRange<uint8_t>(11, 5, 10));
|
||||
|
||||
VerifyOrQuit(ThreeWayCompare<uint8_t>(2, 2) == 0);
|
||||
VerifyOrQuit(ThreeWayCompare<uint8_t>(2, 1) > 0);
|
||||
VerifyOrQuit(ThreeWayCompare<uint8_t>(1, 2) < 0);
|
||||
|
||||
Reference in New Issue
Block a user