From 5786a35453f6c90ba7f4b74a9f722020ccc62140 Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:41:57 +1300 Subject: [PATCH] Linux: Don't define CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD by default (#31053) ... and compile out the related code if it is not defined. --- src/platform/Linux/ConnectivityManagerImpl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index 01d7a9668ff615..718824c6c428e5 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -63,10 +63,6 @@ #include #endif -#ifndef CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD -#define CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD "dhclient -nw %s" -#endif - using namespace ::chip; using namespace ::chip::TLV; using namespace ::chip::DeviceLayer; @@ -1139,6 +1135,10 @@ void ConnectivityManagerImpl::PostNetworkConnect() } } +#if defined(CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD) + // CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD can be defined to a command pattern + // to run once the network has been connected, with a %s placeholder for the + // interface name. E.g. "dhclient -nw %s" // Run dhclient for IP on WiFi. // TODO: The wifi can be managed by networkmanager on linux so we don't have to care about this. char cmdBuffer[128]; @@ -1152,6 +1152,7 @@ void ConnectivityManagerImpl::PostNetworkConnect() { ChipLogProgress(DeviceLayer, "dhclient is running on the %s interface.", sWiFiIfName); } +#endif // defined(CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD) } CHIP_ERROR ConnectivityManagerImpl::CommitConfig()