apmanager: DHCP server support
Start a DHCP server for an AP service when it is configured in server
mode. The server address is configure as "192.168.x.254" where
x is the least significant byte of the service identifier. The DHCP
range is from 192.168.x.1 to 192.168.x.128.
BUG=chromium:438836
TEST=unittests and manual test
Manual test:
Start an AP service using apmanager and verify a DUT can connect
to it with an IP address
CQ-DEPEND=CL:233032,CL:233493
Change-Id: I16a0d03c8eac7f02722c8c8f5185ca75a1edebcb
Reviewed-on: https://chromium-review.googlesource.com/233047
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
diff --git a/config.cc b/config.cc
index 7fa98da..82f3135 100644
--- a/config.cc
+++ b/config.cc
@@ -95,6 +95,12 @@
return ret_value;
}
+bool Config::SsidSet(ErrorPtr* error, const string& ssid) {
+ // TODO(zqiu): validate ssid string.
+ SetSsid(ssid);
+ return true;
+}
+
void Config::RegisterAsync(ExportedObjectManager* object_manager,
AsyncEventSequencer* sequencer) {
CHECK(!dbus_object_) << "Already registered";
@@ -260,10 +266,11 @@
}
// Use the preferred AP interface from the device.
- interface = device_->GetPreferredApInterface();
-
- base::StringAppendF(
- config_str, "%s=%s\n", kHostapdConfigKeyInterface, interface.c_str());
+ selected_interface_ = device_->GetPreferredApInterface();
+ base::StringAppendF(config_str,
+ "%s=%s\n",
+ kHostapdConfigKeyInterface,
+ selected_interface_.c_str());
return true;
}