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

trace: Add tracing for prepared secure messages #16565

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

rgoliver
Copy link

Problem

It would be helpful to have the prepared secure messages to validate some CSG tests.

Change overview

  • Add new traces for the prepared messages for send and receive.
  • Add handlers to pack the data into the json, which can either be streamed to the log or a file using the command line arguments.

Note: This is only enabled when CHIP_CONFIG_TRANSPORT_TRACE is enabled, otherwise this is a no-op.

Testing

ran chip-tool with logging:

chip-tool pairing ble-wifi $node_id $ssid $pass 32423 0 --trace_file trace.log

output snippet:

[1648041423.353875]	SecureMsg.SecMsgSent
    json	{"msg_counter": 647868007, "source_node_id": 8183665693545772584, "session_id": 0, "msg_flags": 4, "security_flags": 0, "exchange_flags": 1, "exchange_id": 31693, "protocol_id": 0, "protocol_opcode": 32, "is_initiator": true, "is_ack_requested": false, "payload_size": 56, "payload_hex": "15300120af17db5285e0d18f09b7199e0be44821e3ce276196f63fb901a747280f5c0d7f240201240300280435052501881325022c011818"}

[1648041423.353908]	SecureMsg.PreparedMsgSent
    json	{"destination": "BLE", "payload_size": 78, "payload_hex": "0400000067ae9d2628b658e0963892710120cd7b000015300120af17db5285e0d18f09b7199e0be44821e3ce276196f63fb901a747280f5c0d7f240201240300280435052501881325022c011818", "buffer_ptr": 140224441100048}

[1648041424.602071]	SecureMsg.PreparedMsgReceived
    json	{"source": "BLE", "payload_size": 134, "payload_hex": "01000000046df14028b658e0963892710021cd7b000015300120af17db5285e0d18f09b7199e0be44821e3ce276196f63fb901a747280f5c0d7f30022008b40ee8183f8d1a2591d83a9360d0725a915d3832560034c25d65e387deb70324030135042501e8033002105350414b453250204b65792053616c741835052501881325022c011818", "buffer_ptr": 140224441144912}

[1648041424.602313]	SecureMsg.SecMsgReceived
    json	{"peer_address": "BLE", "msg_counter": 1089563908, "dest_node_id": 8183665693545772584, "session_id": 0, "msg_flags": 1, "security_flags": 0, "exchange_flags": 0, "exchange_id": 31693, "protocol_id": 0, "protocol_opcode": 33, "is_initiator": false, "is_ack_requested": false, "payload_size": 112, "payload_hex": "15300120af17db5285e0d18f09b7199e0be44821e3ce276196f63fb901a747280f5c0d7f30022008b40ee8183f8d1a2591d83a9360d0725a915d3832560034c25d65e387deb70324030135042501e8033002105350414b453250204b65792053616c741835052501881325022c011818"}

- Add new traces for the prepared messages for send and receive.
- Add handlers to pack the data into json.

Note: This is only enabled when CHIP_CONFIG_TRANSPORT_TRACE is
      enabled, otherwise this is a no-op.
@github-actions
Copy link

github-actions bot commented Mar 23, 2022

PR #16565: Size comparison from 7172ac9 to e249aa0

Increases (11 builds for linux)
platform target config section 7172ac9 e249aa0 change % change
linux all-clusters-app debug (read only) 2478329 2478361 32 0.0
.rodata 211941 211973 32 0.0
bridge-app debug+rpc (read only) 1753373 1753405 32 0.0
.rodata 144556 144588 32 0.0
chip-tool debug (read only) 10163805 10166525 2720 0.0
.rodata 518677 518805 128 0.0
.text 8862405 8864997 2592 0.0
chip-tool-ipv6only arm64 (read only) 9785084 9786716 1632 0.0
.rodata 494308 494356 48 0.0
.text 8238692 8240276 1584 0.0
door-lock-app debug (read only) 2005129 2005161 32 0.0
.rodata 180988 181020 32 0.0
lighting-app debug+rpc (read only) 2178777 2178809 32 0.0
.rodata 175164 175196 32 0.0
ota-provider-app debug (read only) 1946513 1946545 32 0.0
.rodata 166987 167019 32 0.0
ota-requestor-app debug (read only) 1969953 1969985 32 0.0
.rodata 162980 163012 32 0.0
shell debug (read only) 2427657 2427689 32 0.0
.rodata 209362 209394 32 0.0
thermostat-no-ble arm64 (read only) 2262692 2262708 16 0.0
.text 1899600 1899616 16 0.0
tv-app debug (read only) 2678521 2678553 32 0.0
.rodata 207157 207189 32 0.0
Full report (27 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 7172ac9 e249aa0 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603478 603478 0 0.0
.app_xip_area 510576 510576 0 0.0
.bss 75656 75656 0 0.0
.data 596 596 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 561274 561274 0 0.0
.app_xip_area 469900 469900 0 0.0
.bss 74160 74160 0 0.0
.data 560 560 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 572806 572806 0 0.0
.app_xip_area 471784 471784 0 0.0
.bss 83488 83488 0 0.0
.data 500 500 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 922300 922300 0 0.0
(read/write) 128756 128756 0 0.0
.bss 126768 126768 0 0.0
.data 1988 1988 0 0.0
.text 922292 922292 0 0.0
BRD4161A+rpc (read only) 951128 951128 0 0.0
(read/write) 144712 144712 0 0.0
.bss 142544 142544 0 0.0
.data 2168 2168 0 0.0
.text 951120 951120 0 0.0
window-app BRD4161A (read only) 852660 852660 0 0.0
(read/write) 126720 126720 0 0.0
.bss 124856 124856 0 0.0
.data 1864 1864 0 0.0
.text 852652 852652 0 0.0
esp32 all-clusters-app c3devkit (read only) 964156 964156 0 0.0
(read/write) 1393714 1393714 0 0.0
.dram0.bss 62072 62072 0 0.0
.dram0.data 14188 14188 0 0.0
.flash.rodata 198536 198536 0 0.0
.flash.text 964156 964156 0 0.0
.iram0.text 62016 62016 0 0.0
m5stack (read only) 1020687 1020687 0 0.0
(read/write) 461492 461492 0 0.0
.dram0.bss 67600 67600 0 0.0
.dram0.data 34016 34016 0 0.0
.flash.rodata 228040 228040 0 0.0
.flash.text 1015303 1015303 0 0.0
.iram0.text 123107 123107 0 0.0
k32w light k32w061+release (read/write) 701120 701120 0 0.0
.bss 77656 77656 0 0.0
.data 1868 1868 0 0.0
.text 615796 615796 0 0.0
lock k32w061+release (read/write) 701088 701088 0 0.0
.bss 77624 77624 0 0.0
.data 1908 1908 0 0.0
.text 615756 615756 0 0.0
linux all-clusters-app debug (read only) 2478329 2478361 32 0.0
(read/write) 143216 143216 0 0.0
.bss 57312 57312 0 0.0
.data 1264 1264 0 0.0
.data.rel.ro 78904 78904 0 0.0
.dynamic 592 592 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 211941 211973 32 0.0
.text 2102914 2102914 0 0.0
bridge-app debug+rpc (read only) 1753373 1753405 32 0.0
(read/write) 89424 89424 0 0.0
.bss 44456 44456 0 0.0
.data 1952 1952 0 0.0
.data.rel.ro 37944 37944 0 0.0
.dynamic 592 592 0 0.0
.got 3920 3920 0 0.0
.init 27 27 0 0.0
.init_array 544 544 0 0.0
.rodata 144556 144588 32 0.0
.text 1493605 1493605 0 0.0
chip-tool debug (read only) 10163805 10166525 2720 0.0
(read/write) 354944 354944 0 0.0
.bss 22336 22336 0 0.0
.data 1072 1072 0 0.0
.data.rel.ro 325472 325472 0 0.0
.dynamic 608 608 0 0.0
.got 4784 4784 0 0.0
.init 27 27 0 0.0
.init_array 632 632 0 0.0
.rodata 518677 518805 128 0.0
.text 8862405 8864997 2592 0.0
chip-tool-ipv6only arm64 (read only) 9785084 9786716 1632 0.0
(read/write) 472961 472961 0 0.0
.bss 40625 40625 0 0.0
.data 1128 1128 0 0.0
.data.rel.ro 371880 371880 0 0.0
.dynamic 560 560 0 0.0
.got 55528 55528 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 494308 494356 48 0.0
.text 8238692 8240276 1584 0.0
door-lock-app debug (read only) 2005129 2005161 32 0.0
(read/write) 116832 116832 0 0.0
.bss 47584 47584 0 0.0
.data 992 992 0 0.0
.data.rel.ro 62856 62856 0 0.0
.dynamic 592 592 0 0.0
.got 4120 4120 0 0.0
.init 27 27 0 0.0
.init_array 664 664 0 0.0
.rodata 180988 181020 32 0.0
.text 1674482 1674482 0 0.0
lighting-app debug+rpc (read only) 2178777 2178809 32 0.0
(read/write) 123792 123792 0 0.0
.bss 48864 48864 0 0.0
.data 1472 1472 0 0.0
.data.rel.ro 67928 67928 0 0.0
.dynamic 608 608 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 744 744 0 0.0
.rodata 175164 175196 32 0.0
.text 1844594 1844594 0 0.0
ota-provider-app debug (read only) 1946513 1946545 32 0.0
(read/write) 112560 112560 0 0.0
.bss 47456 47456 0 0.0
.data 1256 1256 0 0.0
.data.rel.ro 58200 58200 0 0.0
.dynamic 608 608 0 0.0
.got 4376 4376 0 0.0
.init 27 27 0 0.0
.init_array 616 616 0 0.0
.rodata 166987 167019 32 0.0
.text 1627810 1627810 0 0.0
ota-requestor-app debug (read only) 1969953 1969985 32 0.0
(read/write) 115592 115592 0 0.0
.bss 48480 48480 0 0.0
.data 1416 1416 0 0.0
.data.rel.ro 60264 60264 0 0.0
.dynamic 592 592 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 162980 163012 32 0.0
.text 1654962 1654962 0 0.0
shell debug (read only) 2427657 2427689 32 0.0
(read/write) 147272 147272 0 0.0
.bss 67240 67240 0 0.0
.data 784 784 0 0.0
.data.rel.ro 73536 73536 0 0.0
.dynamic 592 592 0 0.0
.got 4152 4152 0 0.0
.init 27 27 0 0.0
.init_array 920 920 0 0.0
.rodata 209362 209394 32 0.0
.text 2061570 2061570 0 0.0
thermostat-no-ble arm64 (read only) 2262692 2262708 16 0.0
(read/write) 148273 148273 0 0.0
.bss 62753 62753 0 0.0
.data 1024 1024 0 0.0
.data.rel.ro 77000 77000 0 0.0
.dynamic 560 560 0 0.0
.got 4480 4480 0 0.0
.init 24 24 0 0.0
.init_array 360 360 0 0.0
.rodata 139780 139780 0 0.0
.text 1899600 1899616 16 0.0
tv-app debug (read only) 2678521 2678553 32 0.0
(read/write) 247744 247744 0 0.0
.bss 164416 164416 0 0.0
.data 3104 3104 0 0.0
.data.rel.ro 74168 74168 0 0.0
.dynamic 592 592 0 0.0
.got 4552 4552 0 0.0
.init 27 27 0 0.0
.init_array 888 888 0 0.0
.rodata 207157 207189 32 0.0
.text 2296514 2296514 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2353636 2353636 0 0.0
.bss 184652 184652 0 0.0
.data 5752 5752 0 0.0
.text 1316236 1316236 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1138947 1138947 0 0.0
bss 142588 142588 0 0.0
rodata 141516 141516 0 0.0
text 780084 780084 0 0.0
p6 all-clusters-app default (read/write) 2493592 2493592 0 0.0
.bss 118072 118072 0 0.0
.data 2632 2632 0 0.0
.text 1451856 1451856 0 0.0
light-app default (read/write) 2396776 2396776 0 0.0
.bss 111544 111544 0 0.0
.data 2488 2488 0 0.0
.text 1355040 1355040 0 0.0
lock-app default (read/write) 2360312 2360312 0 0.0
.bss 111288 111288 0 0.0
.data 2448 2448 0 0.0
.text 1318576 1318576 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 896954 896954 0 0.0
bss 87444 87444 0 0.0
noinit 37160 37160 0 0.0
text 634304 634304 0 0.0

@andy31415 andy31415 merged commit dad6375 into project-chip:master Mar 24, 2022
andrei-menzopol pushed a commit to andrei-menzopol/connectedhomeip that referenced this pull request Apr 14, 2022
- Add new traces for the prepared messages for send and receive.
- Add handlers to pack the data into json.

Note: This is only enabled when CHIP_CONFIG_TRANSPORT_TRACE is
      enabled, otherwise this is a no-op.
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.

3 participants