Allow starting dnsmasq without DHCP
dnsmasq will not start DHCP if no --dhcp-range flag is set. Allow
tethering start command to be called without DHCP ranges, so dnsmasq can
be started without this flag.
Bug: b/109584964
Test: manual: flashed a build with no --dhcp-range flag
Change-Id: I109f64240690aef701deabd49120eab0aba0e8a8
diff --git a/server/TetherController.cpp b/server/TetherController.cpp
index c7f3042..0ca1b77 100644
--- a/server/TetherController.cpp
+++ b/server/TetherController.cpp
@@ -247,10 +247,10 @@
"--user", kDnsmasqUsername,
};
+ // DHCP server will be disabled if num_addrs == 0 and no --dhcp-range is passed.
for (int addrIndex = 0; addrIndex < num_addrs; addrIndex += 2) {
- argVector.push_back(
- StringPrintf("--dhcp-range=%s,%s,1h",
- dhcp_ranges[addrIndex], dhcp_ranges[addrIndex+1]));
+ argVector.push_back(StringPrintf("--dhcp-range=%s,%s,1h", dhcp_ranges[addrIndex],
+ dhcp_ranges[addrIndex + 1]));
}
auto args = (char**)std::calloc(argVector.size() + 1, sizeof(char*));