From b673d949aa5c06e8d4878a2369b70b75a7efd3ea Mon Sep 17 00:00:00 2001 From: Kevin Coppock <47542933+g-coppock@users.noreply.github.com> Date: Wed, 28 Sep 2022 19:59:57 -0600 Subject: [PATCH] Ensure scope IDs are supported for PASE by address (#22945) Previous change: https://github.com/project-chip/connectedhomeip/pull/19394/files This JNI wrapper was overlooked but will fail with an invalid argument error if called with an IPv6 address including a scope ID (e.g. fe80::0:2%wlan0). Tested: * Ran the changes locally, forcing a scope ID suffix %wlan0 --- src/controller/java/CHIPDeviceController-JNI.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 2a4d7e9cc97755..6c047d8f9adf86 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -507,14 +507,10 @@ JNI_METHOD(void, establishPaseConnectionByAddress) CHIP_ERROR err = CHIP_NO_ERROR; AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); - Inet::IPAddress addr; JniUtfString addrJniString(env, address); - VerifyOrReturn(Inet::IPAddress::FromString(addrJniString.c_str(), addr), - ChipLogError(Controller, "Failed to parse IP address."), - JniReferences::GetInstance().ThrowError(env, sChipDeviceControllerExceptionCls, CHIP_ERROR_INVALID_ARGUMENT)); - RendezvousParameters rendezvousParams = - RendezvousParameters().SetSetupPINCode(pinCode).SetPeerAddress(Transport::PeerAddress::UDP(addr, port)); + RendezvousParameters rendezvousParams = RendezvousParameters().SetSetupPINCode(pinCode).SetPeerAddress( + Transport::PeerAddress::UDP(const_cast(addrJniString.c_str()), port)); err = wrapper->Controller()->EstablishPASEConnection(deviceId, rendezvousParams);