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

[controller] Add IP rendezvous feature to CHIP Device controller #4050

Merged
merged 16 commits into from
Dec 9, 2020

Conversation

erjiaqing
Copy link
Contributor

@erjiaqing erjiaqing commented Dec 2, 2020

Problem

Basic IP rendezvous is supported on device side, however, when using chip-tool pairing softap:

± % ./out/chip-tool pairing softap 111 111 12345678 1383 fd12::2 11097
CHIP:IN: TransportMgr initialized
CHIP:IN: local node id is 112233

CHIP:DL: Avahi connecting
CHIP:DL: CHIP task running
CHIP:DL: wpa_supplicant: connected to wpa_supplicant proxy
CHIP:DL: wpa_supplicant: can't find interface wlan0: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.37645" (uid=699939 pid=2945875 comm="./out/chip-tool pairing softap 111 111 12345678 13") interface="fi.w1.wpa_supplicant1" member="GetInterface" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=1080 comm="/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant ")
CHIP:DL: wpa_supplicant: try to create interface wlan0
CHIP:DL: wpa_supplicant: failed to create interface wlan0: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.37645" (uid=699939 pid=2945875 comm="./out/chip-tool pairing softap 111 111 12345678 13") interface="fi.w1.wpa_supplicant1" member="CreateInterface" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=1080 comm="/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant ")

It does not work.

Summary of Changes

  1. Add necessary changes to chip device controller to make chip-tool pairing softap work
  2. Add connect -ip command to python binding
  3. Update cirque test to use IP rendezvous feature.

Testing

Tested w/ rpi running ubuntu 20.10 desktop.

± % ./out/chip-tool pairing softap 111 111 12345678 1383 fd12::2 11097
CHIP:IN: TransportMgr initialized
CHIP:IN: local node id is 112233

CHIP:DL: wpa_supplicant: connected to wpa_supplicant proxy
CHIP:DL: Avahi connecting
CHIP:DL: CHIP task running
CHIP:DL: wpa_supplicant: can't find interface wlan0: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.37647" (uid=699939 pid=2947087 comm="./out/chip-tool pairing softap 111 111 12345678 13") interface="fi.w1.wpa_supplicant1" member="GetInterface" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=1080 comm="/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant ")
CHIP:DL: wpa_supplicant: try to create interface wlan0
CHIP:DL: wpa_supplicant: failed to create interface wlan0: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.37647" (uid=699939 pid=2947087 comm="./out/chip-tool pairing softap 111 111 12345678 13") interface="fi.w1.wpa_supplicant1" member="CreateInterface" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=1080 comm="/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant ")
CHIP:BLE: Received rendezvous message from 12344321
CHIP:CTL: Remote device completed SPAKE2+ handshake

CHIP:TOO: Secure Pairing Success
CHIP:TOO: Pairing Success
CHIP:CTL: Shutting down the commissioner
CHIP:CTL: Shutting down the controller
± % ./out/chip-tool onoff on 1
CHIP:IN: TransportMgr initialized
CHIP:IN: local node id is 112233

CHIP:DL: wpa_supplicant: connected to wpa_supplicant proxy
CHIP:DL: wpa_supplicant: can't find interface wlan0: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.37653" (uid=699939 pid=2947349 comm="./out/chip-tool onoff on 1 ") interface="fi.w1.wpa_supplicant1" member="GetInterface" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=1080 comm="/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant ")
CHIP:DL: wpa_supplicant: try to create interface wlan0
CHIP:DL: wpa_supplicant: failed to create interface wlan0: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.37653" (uid=699939 pid=2947349 comm="./out/chip-tool onoff on 1 ") interface="fi.w1.wpa_supplicant1" member="CreateInterface" error name="(unset)" requested_reply="0" destination=":1.1" (uid=0 pid=1080 comm="/sbin/wpa_supplicant -u -s -O /run/wpa_supplicant ")
CHIP:DL: Avahi connecting
CHIP:DL: CHIP task running
CHIP:TOO: Endpoint id: '0x01', Cluster id: '0x0006', Command id: '0x01'
CHIP:ZCL: Successfully encoded 11 bytes
CHIP:DL: select failed: OS Error 2009 (0x000007D9): Bad file descriptor

CHIP:IN: New pairing for device 12344321, key 0!!
CHIP:IN: Sending msg from 112233 to 12344321
CHIP:IN: Secure transport transmitting msg 0 after encryption
CHIP:CTL: SendMessage returned 0
CHIP:TOO: OnMessage: Received 16 bytes
CHIP:TOO: APS frame processing success!
CHIP:TOO: DefaultResponse (0x0B):
CHIP:TOO:   commandId: 0x01
CHIP:TOO:   status: EMBER_ZCL_STATUS_SUCCESS (0x00)
CHIP:CTL: Shutting down the commissioner
CHIP:CTL: Shutting down the controller
± % chip-device-ctrl
CHIP:IN: TransportMgr initialized
CHIP:IN: local node id is 112233

CHIP:DL: Avahi connecting
Chip Device Controller Shell

chip-device-ctrl > connect -ip fd12::2 12345678
Rendezvoud Complete
Connected
chip-device-ctrl > CHIP:BLE: Received rendezvous message from 12344321
CHIP:CTL: Remote device completed SPAKE2+ handshake


chip-device-ctrl > 

After this PR, chip-device-ctrl can establish pase sessions, however, no traffic will use it, I will submit another pr for adding cluster support to chip device controller python binding. There are some special checks for BLE rendezvous, and they should be removed in the future after network provisioning cluster is ready.

Fixes #4038

src/controller/CHIPDeviceController.cpp Show resolved Hide resolved
@@ -530,10 +536,35 @@ void nl_Chip_DeviceController_SetLogFilter(uint8_t category)
CHIP_ERROR nl_Chip_DeviceController_Connect(chip::DeviceController::ChipDeviceController * devCtrl, BLE_CONNECTION_OBJECT connObj,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated question: why do we have a 'nl' prefix here? I am generally used to nl meaning 'nest labs' and then we can replace with just 'chip_DeviceController_connect' and similar and omit the nl prefix.

src/transport/RendezvousSession.cpp Show resolved Hide resolved
@yunhanw-google yunhanw-google self-requested a review December 2, 2020 19:20
@erjiaqing
Copy link
Contributor Author

@andy31415 @rwalker-apple PTAL

@rwalker-apple
Copy link
Contributor

@pan-apple?

@github-actions
Copy link

github-actions bot commented Dec 8, 2020

Size increase report for "esp32-example-build" from d2645f9

File Section File VM
chip-all-clusters-app.elf .flash.text 224 224
chip-all-clusters-app.elf .dram0.bss 0 48
chip-all-clusters-app.elf .flash.rodata 32 32
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-all-clusters-app.elf and ./pull_artifact/chip-all-clusters-app.elf:

sections,vmsize,filesize
.debug_info,0,634
.debug_line,0,547
.debug_loc,0,256
.flash.text,224,224
.xt.prop._ZNK4chip20RendezvousParameters12IsControllerEv,0,128
.shstrtab,0,112
.dram0.bss,48,0
.strtab,0,48
.symtab,0,48
.flash.rodata,32,32
.debug_frame,0,24
.debug_str,0,24
.debug_aranges,0,8
.xt.prop._ZTVN4chip11DeviceLayer37DeviceNetworkProvisioningDelegateImplE,0,-3
.debug_ranges,0,-32
[Unmapped],0,-32
.debug_abbrev,0,-34


@github-actions
Copy link

github-actions bot commented Dec 8, 2020

Size increase report for "nrfconnect-example-build" from d2645f9

File Section File VM
chip-lock.elf text 232 232
chip-lock.elf bss 0 51
chip-lock.elf rodata 32 32
chip-lock.elf shell_root_cmds_sections 8 8
chip-lock.elf [LOAD #3 [RW]] 0 -19
chip-lighting.elf text 228 228
chip-lighting.elf bss 0 59
chip-lighting.elf rodata 32 32
chip-lighting.elf shell_root_cmds_sections -4 -4
chip-lighting.elf [LOAD #3 [RW]] 0 -27
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-lock.elf and ./pull_artifact/chip-lock.elf:

sections,vmsize,filesize
.debug_info,0,525
.debug_line,0,309
text,232,232
.debug_loc,0,168
.debug_abbrev,0,74
.debug_frame,0,52
bss,51,0
.strtab,0,48
.symtab,0,48
rodata,32,32
.debug_str,0,24
.debug_aranges,0,8
shell_root_cmds_sections,8,8
[LOAD #3 [RW]],-19,0
.debug_ranges,0,-88

Comparing ./master_artifact/chip-lighting.elf and ./pull_artifact/chip-lighting.elf:

sections,vmsize,filesize
.debug_info,0,525
.debug_line,0,309
text,228,228
.debug_loc,0,176
.debug_abbrev,0,74
bss,59,0
.debug_frame,0,52
.strtab,0,48
.symtab,0,48
rodata,32,32
.debug_str,0,24
.debug_aranges,0,8
shell_root_cmds_sections,-4,-4
[LOAD #3 [RW]],-27,0
.debug_ranges,0,-88

Comparing ./master_artifact/chip-shell.elf and ./pull_artifact/chip-shell.elf:

sections,vmsize,filesize


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.

Add IP pairing support to chip tool / chip device controller
7 participants