openthread / ot-commissioner

OpenThread Commissioner, a Thread commissioner for joining new Thread devices and managing Thread networks.
https://openthread.io/
BSD 3-Clause "New" or "Revised" License
49 stars 36 forks source link

Commissioner is not passing vendor data #284

Closed krbvroc1 closed 2 months ago

krbvroc1 commented 2 months ago

I just spent a considerable time trying to figure out why passing some custom vendor data from my Joiner device to my custom commissioner (which uses ot-commissioner library) was invoking my application OnJoinerFinalize() with a nullptr for the vendorData. It turns out if the provisioningUrl is NULL, the vendorData sent from the Joiner is not passed along. I believe I traced the problem to the below code. I think this violates the Thread specification. There is NO mention that the vendorData MUST not be passed if not accompanied by a provisioningUrl. Can this be fixed please? As a workaround I could put some sort of data in the provisioningUrl, but that implies some extra joiner flow and it not really what I want to do.

https://github.com/openthread/ot-commissioner/blob/5223d71b8cfbcb4a22da2aae80c07dc801e4bf4a/src/library/joiner_session.cpp#L188-L195

Note that there is no such qualification in openthread itself... https://github.com/openthread/openthread/blob/473fbcaba93972b62d94c5e0492044bdda340e1f/src/core/meshcop/joiner.cpp#L436-L444

wgtdkp commented 2 months ago

Hey @krbvroc1, thanks for reporting this issue and digging into the code. It sounds good to allow this. I sent the PR https://github.com/openthread/ot-commissioner/pull/285 for fixing this. Could you help check if this works for you?

krbvroc1 commented 2 months ago

@wgtdkp Yes, I tested the fix and it works. Thanks.