From 069f0d53270f7ca9d9da2eea254cf15a2895e28b Mon Sep 17 00:00:00 2001 From: Sagar Dhawan Date: Mon, 30 Aug 2021 11:44:04 -0700 Subject: [PATCH 1/3] Do not hardcode the UDP listen port in ChipDeviceController --- src/controller/CHIPDeviceController.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 5c0c2b50e5c1fe..e5bd164de7bec5 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -109,7 +109,7 @@ DeviceController::DeviceController() mExchangeMgr = nullptr; mStorageDelegate = nullptr; mPairedDevicesInitialized = false; - mListenPort = CHIP_PORT; + mListenPort = 0; } CHIP_ERROR DeviceController::Init(ControllerInitParams params) From 251564e24c5022697a308dc792b72eee5bc675c0 Mon Sep 17 00:00:00 2001 From: Sagar Dhawan Date: Mon, 30 Aug 2021 12:12:47 -0700 Subject: [PATCH 2/3] Add the listen port to the init params --- src/controller/CHIPDeviceController.cpp | 2 +- src/controller/CHIPDeviceController.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index e5bd164de7bec5..f5bea2ee840858 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -109,7 +109,6 @@ DeviceController::DeviceController() mExchangeMgr = nullptr; mStorageDelegate = nullptr; mPairedDevicesInitialized = false; - mListenPort = 0; } CHIP_ERROR DeviceController::Init(ControllerInitParams params) @@ -120,6 +119,7 @@ CHIP_ERROR DeviceController::Init(ControllerInitParams params) { mSystemLayer = params.systemLayer; mInetLayer = params.inetLayer; + mListenPort = params.listenPort; } else { diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index c9eee9bca1df7e..95fba0a06e0d50 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -102,6 +102,10 @@ struct ControllerInitParams ByteSpan controllerRCAC; uint16_t controllerVendorId; + + /* The port used by the controller to listen for and send messages. + * The default value of `0` will pick any available port. */ + uint16_t listenPort = 0; }; enum CommissioningStage : uint8_t From 67743b1e4105bd9297f1814e8efa28cdf54e03c4 Mon Sep 17 00:00:00 2001 From: Sagar Dhawan Date: Mon, 30 Aug 2021 13:29:32 -0700 Subject: [PATCH 3/3] Update src/controller/CHIPDeviceController.h Co-authored-by: Tennessee Carmel-Veilleux --- src/controller/CHIPDeviceController.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 95fba0a06e0d50..f432a346286d61 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -103,7 +103,7 @@ struct ControllerInitParams uint16_t controllerVendorId; - /* The port used by the controller to listen for and send messages. + /* The port used for operational communication to listen for and send messages over UDP/TCP. * The default value of `0` will pick any available port. */ uint16_t listenPort = 0; };