From 3f29f0249abdfa12a290eb29e07f55a9fb0285d6 Mon Sep 17 00:00:00 2001 From: Kevin Coppock Date: Wed, 28 Sep 2022 17:53:32 -0500 Subject: [PATCH] Ensure scope IDs are supported for PASE by address 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);