mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 02:19:52 +00:00
[mac] update the cached supported channel mask when the region code changes (#9418)
The current code of the `mac.cpp` caches the supported channel mask to a local variable. But the supported channel mask may be changed after the country code is changed. This will cause the supported channel mask used in `mac.cpp` to be inconsistent with the actual supported channel mask. This commit adds an API `otLinkSetRegion()` to set the region code and then update the cached supported channel mask to avoid the channel mask inconsistencies. The current Thread channel may be not included in the new supported channel mask. When the Thread stack detects this case, it detaches the current Thread network gracefully.
This commit is contained in:
@@ -61,4 +61,38 @@ send "channel preferred\n"
|
||||
expect "0x1fff800"
|
||||
expect_line "Done"
|
||||
|
||||
send "region US\n"
|
||||
expect_line "Done"
|
||||
|
||||
send "channel supported\n"
|
||||
expect "0x7fff800"
|
||||
expect_line "Done"
|
||||
|
||||
send "dataset init new\n"
|
||||
expect_line "Done"
|
||||
send "dataset channel 26\n"
|
||||
expect_line "Done"
|
||||
send "dataset commit active\n"
|
||||
expect_line "Done"
|
||||
|
||||
attach "leader"
|
||||
|
||||
send "channel\n"
|
||||
expect "26"
|
||||
expect_line "Done"
|
||||
|
||||
send "region WW\n"
|
||||
expect_line "Done"
|
||||
|
||||
wait_for "state" "disabled"
|
||||
expect_line "Done"
|
||||
|
||||
send "channel supported\n"
|
||||
expect "0x3fff800"
|
||||
expect_line "Done"
|
||||
|
||||
send "channel\n"
|
||||
expect "26"
|
||||
expect_line "Done"
|
||||
|
||||
dispose_node 1
|
||||
|
||||
Reference in New Issue
Block a user