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

Change mrp-parameter-struct to hold 32-bit milliseconds #17978

Merged
merged 2 commits into from
May 3, 2022

Conversation

msandstedt
Copy link
Contributor

Problem

Nodes store and advertise MRP parameters as 32-bit values. However,
the mrp-parameter-struct had been specified to only hold 16-bit values
on the wire. This would lead to session establishment failures with
nodes attempting to exchange values in excess of 65536 milliseconds,
despite the fact that values up to 360,000 milliseconds are legal.

Change overview

This corrects the problem to allow up-to 32-bit values per the spec
change here:

https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/5173

In most cases, peers will be using smaller MRP values and and will
therefore still exchange 1 or 2-byte fields on the wire, making this
change mostly backward compatible.

Fixes #17812

Testing

Testing: verification of successful exchange of larger MRP values up
to 360,000 has been added to TestCASESession.cpp. TestTxtFields.cpp
already has coverage for advertisement of large values.

Nodes store and advertise MRP parameters as 32-bit values.  However,
the mrp-parameter-struct had been specified to only hold 16-bit values
on the wire.  This would lead to session establishment failures with
nodes attempting to exchange values in excess of 65536 milliseconds,
despite the fact that values up to 360,000 milliseconds are legal.

This corrects the problem to allow up-to 32-bit values per the spec
change here:

https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/5173

In most cases, peers will be using smaller MRP values and and will
therefore still exchange 1 or 2-byte fields on the wire, making this
change mostly backward compatible.

Testing: verification of successful exchange of larger MRP values up
to 360,000 has been added to TestCASESession.cpp.  TestTxtFields.cpp
already has coverage for advertisement of large values.

Fixes project-chip#17812
@github-actions
Copy link

github-actions bot commented May 2, 2022

PR #17978: Size comparison from 769264a to 3812be3

Increases (4 builds for cc13x2_26x2)
platform target config section 769264a 3812be3 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read/write) 163352 163384 32 0.0
lock-ftd LP_CC2652R7 (read/write) 166752 166784 32 0.0
pump-app LP_CC2652R7 (read/write) 183484 183524 40 0.0
pump-controller-app LP_CC2652R7 (read/write) 190388 190420 32 0.0
Decreases (33 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, nrfconnect, p6, telink)
platform target config section 769264a 3812be3 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 688903 688871 -32 -0.0
.text 586116 586084 -32 -0.0
lock-ftd LP_CC2652R7 (read only) 676759 676727 -32 -0.0
.text 581920 581888 -32 -0.0
lock-mtd LP_CC2652R7 (read only) 625519 625487 -32 -0.0
.text 530784 530752 -32 -0.0
pump-app LP_CC2652R7 (read only) 661267 661227 -40 -0.0
.text 580396 580356 -40 -0.0
pump-controller-app LP_CC2652R7 (read only) 654163 654131 -32 -0.0
.text 570356 570324 -32 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 626362 626330 -32 -0.0
.app_xip_area 528896 528864 -32 -0.0
lock cyw930739m2evb_01 (read/write) 625074 625034 -40 -0.0
.app_xip_area 529072 529032 -40 -0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 574210 574170 -40 -0.0
.app_xip_area 468588 468548 -40 -0.0
efr32 lighting-app BRD4161A (read only) 908184 908152 -32 -0.0
.text 908176 908144 -32 -0.0
BRD4161A+rpc (read only) 942528 942496 -32 -0.0
.text 942520 942488 -32 -0.0
BRD4161A+rs911x (read only) 746548 746516 -32 -0.0
.text 746540 746508 -32 -0.0
lock-app BRD4161A+wf200 (read only) 916560 916512 -48 -0.0
.text 916552 916504 -48 -0.0
window-app BRD4161A (read only) 845416 845384 -32 -0.0
.text 845408 845376 -32 -0.0
esp32 all-clusters-app c3devkit (read only) 999682 999648 -34 -0.0
.flash.text 999682 999648 -34 -0.0
m5stack (read only) 1054807 1054787 -20 -0.0
.flash.text 1049423 1049403 -20 -0.0
k32w light k32w061+release (read/write) 684236 684188 -48 -0.0
.text 599204 599156 -48 -0.0
lock k32w061+release (read/write) 729036 729004 -32 -0.0
.text 643620 643588 -32 -0.0
linux all-clusters-app debug (read only) 2729929 2729801 -128 -0.0
.text 2320130 2320002 -128 -0.0
bridge-app debug+rpc (read only) 1885025 1884897 -128 -0.0
.text 1602178 1602050 -128 -0.0
chip-tool debug (read only) 8976293 8976165 -128 -0.0
.text 7189957 7189829 -128 -0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 8816212 8816100 -112 -0.0
.text 6926804 6926692 -112 -0.0
lighting-app debug+rpc (read only) 2319385 2319273 -112 -0.0
.text 1968514 1968402 -112 -0.0
lock-app debug (read only) 2225601 2225473 -128 -0.0
.text 1871346 1871218 -128 -0.0
ota-provider-app debug (read only) 2054241 2054129 -112 -0.0
.text 1722018 1721906 -112 -0.0
ota-requestor-app debug (read only) 2085297 2085185 -112 -0.0
.text 1755314 1755202 -112 -0.0
shell debug (read only) 2554985 2554873 -112 -0.0
.text 2176738 2176626 -112 -0.0
thermostat-no-ble arm64 (read only) 2360916 2360804 -112 -0.0
.text 1985936 1985824 -112 -0.0
tv-app debug (read only) 2840833 2840705 -128 -0.0
.text 2441618 2441490 -128 -0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1177691 1177659 -32 -0.0
text 808632 808596 -36 -0.0
p6 all-clusters-app default (read/write) 2528576 2528544 -32 -0.0
.text 1486840 1486808 -32 -0.0
light-app default (read/write) 2419176 2419144 -32 -0.0
.text 1377440 1377408 -32 -0.0
lock-app default (read/write) 2428464 2428432 -32 -0.0
.text 1386728 1386696 -32 -0.0
telink lighting-app tlsr9518adk80d (read/write) 804440 804400 -40 -0.0
text 571258 571222 -36 -0.0
Full report (34 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 769264a 3812be3 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 688903 688871 -32 -0.0
(read/write) 163352 163384 32 0.0
.bss 75236 75236 0 0.0
.data 3400 3400 0 0.0
.rodata 102303 102303 0 0.0
.text 586116 586084 -32 -0.0
lock-ftd LP_CC2652R7 (read only) 676759 676727 -32 -0.0
(read/write) 166752 166784 32 0.0
.bss 73548 73548 0 0.0
.data 3224 3224 0 0.0
.rodata 94359 94359 0 0.0
.text 581920 581888 -32 -0.0
lock-mtd LP_CC2652R7 (read only) 625519 625487 -32 -0.0
(read/write) 146352 146352 0 0.0
.bss 69268 69268 0 0.0
.data 3224 3224 0 0.0
.rodata 94247 94247 0 0.0
.text 530784 530752 -32 -0.0
pump-app LP_CC2652R7 (read only) 661267 661227 -40 -0.0
(read/write) 183484 183524 40 0.0
.bss 73764 73764 0 0.0
.data 3256 3256 0 0.0
.rodata 80387 80387 0 0.0
.text 580396 580356 -40 -0.0
pump-controller-app LP_CC2652R7 (read only) 654163 654131 -32 -0.0
(read/write) 190388 190420 32 0.0
.bss 73820 73820 0 0.0
.data 3220 3220 0 0.0
.rodata 83323 83323 0 0.0
.text 570356 570324 -32 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 626362 626330 -32 -0.0
.app_xip_area 528896 528864 -32 -0.0
.bss 80116 80116 0 0.0
.data 696 696 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 625074 625034 -40 -0.0
.app_xip_area 529072 529032 -40 -0.0
.bss 78692 78692 0 0.0
.data 660 660 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 574210 574170 -40 -0.0
.app_xip_area 468588 468548 -40 -0.0
.bss 88016 88016 0 0.0
.data 572 572 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 908184 908152 -32 -0.0
(read/write) 134528 134528 0 0.0
.bss 132472 132472 0 0.0
.data 2052 2052 0 0.0
.text 908176 908144 -32 -0.0
BRD4161A+rpc (read only) 942528 942496 -32 -0.0
(read/write) 151208 151208 0 0.0
.bss 148952 148952 0 0.0
.data 2256 2256 0 0.0
.text 942520 942488 -32 -0.0
BRD4161A+rs911x (read only) 746548 746516 -32 -0.0
(read/write) 128752 128752 0 0.0
.bss 126772 126772 0 0.0
.data 1980 1980 0 0.0
.text 746540 746508 -32 -0.0
lock-app BRD4161A+wf200 (read only) 916560 916512 -48 -0.0
(read/write) 127540 127540 0 0.0
.bss 125604 125604 0 0.0
.data 1936 1936 0 0.0
.text 916552 916504 -48 -0.0
window-app BRD4161A (read only) 845416 845384 -32 -0.0
(read/write) 132616 132616 0 0.0
.bss 130648 130648 0 0.0
.data 1964 1964 0 0.0
.text 845408 845376 -32 -0.0
esp32 all-clusters-app c3devkit (read only) 999682 999648 -34 -0.0
(read/write) 1474506 1474506 0 0.0
.dram0.bss 68376 68376 0 0.0
.dram0.data 14428 14428 0 0.0
.flash.rodata 207248 207248 0 0.0
.flash.text 999682 999648 -34 -0.0
.iram0.text 62020 62020 0 0.0
m5stack (read only) 1054807 1054787 -20 -0.0
(read/write) 476936 476936 0 0.0
.dram0.bss 73896 73896 0 0.0
.dram0.data 34176 34176 0 0.0
.flash.rodata 237028 237028 0 0.0
.flash.text 1049423 1049403 -20 -0.0
.iram0.text 123107 123107 0 0.0
k32w light k32w061+release (read/write) 684236 684188 -48 -0.0
.bss 81320 81320 0 0.0
.data 2008 2008 0 0.0
.text 599204 599156 -48 -0.0
lock k32w061+release (read/write) 729036 729004 -32 -0.0
.bss 81744 81744 0 0.0
.data 1968 1968 0 0.0
.text 643620 643588 -32 -0.0
linux all-clusters-app debug (read only) 2729929 2729801 -128 -0.0
(read/write) 173144 173144 0 0.0
.bss 83360 83360 0 0.0
.data 2000 2000 0 0.0
.data.rel.ro 81656 81656 0 0.0
.dynamic 608 608 0 0.0
.got 4464 4464 0 0.0
.init 27 27 0 0.0
.init_array 1008 1008 0 0.0
.rodata 235173 235173 0 0.0
.text 2320130 2320002 -128 -0.0
bridge-app debug+rpc (read only) 1885025 1884897 -128 -0.0
(read/write) 120440 120440 0 0.0
.bss 71360 71360 0 0.0
.data 3424 3424 0 0.0
.data.rel.ro 40312 40312 0 0.0
.dynamic 592 592 0 0.0
.got 4032 4032 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 160449 160449 0 0.0
.text 1602178 1602050 -128 -0.0
chip-tool debug (read only) 8976293 8976165 -128 -0.0
(read/write) 576464 576464 0 0.0
.bss 22592 22592 0 0.0
.data 1136 1136 0 0.0
.data.rel.ro 546472 546472 0 0.0
.dynamic 624 624 0 0.0
.got 4952 4952 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 463189 463189 0 0.0
.text 7189957 7189829 -128 -0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 8816212 8816100 -112 -0.0
(read/write) 642641 642641 0 0.0
.bss 40913 40913 0 0.0
.data 1192 1192 0 0.0
.data.rel.ro 581752 581752 0 0.0
.dynamic 560 560 0 0.0
.got 14960 14960 0 0.0
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 430900 430900 0 0.0
.text 6926804 6926692 -112 -0.0
lighting-app debug+rpc (read only) 2319385 2319273 -112 -0.0
(read/write) 151392 151392 0 0.0
.bss 73408 73408 0 0.0
.data 1984 1984 0 0.0
.data.rel.ro 70248 70248 0 0.0
.dynamic 608 608 0 0.0
.got 4320 4320 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 184617 184617 0 0.0
.text 1968514 1968402 -112 -0.0
lock-app debug (read only) 2225601 2225473 -128 -0.0
(read/write) 145976 145976 0 0.0
.bss 72032 72032 0 0.0
.data 1504 1504 0 0.0
.data.rel.ro 66760 66760 0 0.0
.dynamic 592 592 0 0.0
.got 4312 4312 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 194353 194353 0 0.0
.text 1871346 1871218 -128 -0.0
ota-provider-app debug (read only) 2054241 2054129 -112 -0.0
(read/write) 138992 138992 0 0.0
.bss 71424 71424 0 0.0
.data 1672 1672 0 0.0
.data.rel.ro 60104 60104 0 0.0
.dynamic 608 608 0 0.0
.got 4480 4480 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 175099 175099 0 0.0
.text 1722018 1721906 -112 -0.0
ota-requestor-app debug (read only) 2085297 2085185 -112 -0.0
(read/write) 141800 141800 0 0.0
.bss 72064 72064 0 0.0
.data 1928 1928 0 0.0
.data.rel.ro 62184 62184 0 0.0
.dynamic 592 592 0 0.0
.got 4320 4320 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 171372 171372 0 0.0
.text 1755314 1755202 -112 -0.0
shell debug (read only) 2554985 2554873 -112 -0.0
(read/write) 197104 197104 0 0.0
.bss 114088 114088 0 0.0
.data 1376 1376 0 0.0
.data.rel.ro 75920 75920 0 0.0
.dynamic 592 592 0 0.0
.got 4184 4184 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 216722 216722 0 0.0
.text 2176738 2176626 -112 -0.0
thermostat-no-ble arm64 (read only) 2360916 2360804 -112 -0.0
(read/write) 174593 174593 0 0.0
.bss 86273 86273 0 0.0
.data 1496 1496 0 0.0
.data.rel.ro 79048 79048 0 0.0
.dynamic 560 560 0 0.0
.got 4736 4736 0 0.0
.init 24 24 0 0.0
.init_array 376 376 0 0.0
.rodata 145828 145828 0 0.0
.text 1985936 1985824 -112 -0.0
tv-app debug (read only) 2840833 2840705 -128 -0.0
(read/write) 276608 276608 0 0.0
.bss 189272 189272 0 0.0
.data 4640 4640 0 0.0
.data.rel.ro 76456 76456 0 0.0
.dynamic 592 592 0 0.0
.got 4696 4696 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 217163 217163 0 0.0
.text 2441618 2441490 -128 -0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2418124 2418124 0 0.0
.bss 205884 205884 0 0.0
.data 5856 5856 0 0.0
.text 1380724 1380724 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1177691 1177659 -32 -0.0
bss 139600 139600 0 0.0
rodata 150804 150804 0 0.0
text 808632 808596 -36 -0.0
p6 all-clusters-app default (read/write) 2528576 2528544 -32 -0.0
.bss 139256 139256 0 0.0
.data 2792 2792 0 0.0
.text 1486840 1486808 -32 -0.0
light-app default (read/write) 2419176 2419144 -32 -0.0
.bss 132720 132720 0 0.0
.data 2592 2592 0 0.0
.text 1377440 1377408 -32 -0.0
lock-app default (read/write) 2428464 2428432 -32 -0.0
.bss 132544 132544 0 0.0
.data 2552 2552 0 0.0
.text 1386728 1386696 -32 -0.0
telink lighting-app tlsr9518adk80d (read/write) 804440 804400 -40 -0.0
bss 72232 72232 0 0.0
noinit 40416 40416 0 0.0
text 571258 571222 -36 -0.0

@andy31415 andy31415 merged commit 2103225 into project-chip:master May 3, 2022
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.

Secure session establishment can fail if local MRP parameters cannot fit within 16 bits
4 participants