Skip to content

Commit

Permalink
Ensure scope IDs are supported for PASE by address (#22945)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
g-coppock authored and pull[bot] committed Jul 6, 2023
1 parent 407a997 commit 14b4977
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<char *>(addrJniString.c_str()), port));

err = wrapper->Controller()->EstablishPASEConnection(deviceId, rendezvousParams);

Expand Down

0 comments on commit 14b4977

Please sign in to comment.