static int const PORT(getpid() % 1000 + 2000);
static string const PID_STR(to_string(PID));
static string const PORT_STR(to_string(PORT));
+static string const ADDRESS("0.0.0.0");
static string const KEA_DHCP4_CONF(KEA_FUZZ_DIR + "/kea-dhcp4-" + PID_STR + ".conf");
static string const KEA_DHCP4_CSV(KEA_FUZZ_DIR + "/kea-dhcp4-" + PID_STR + ".csv");
-void timeoutHandler() {
- cerr << "Timeout occurred while fuzzing!" << endl;
- abort();
-}
-
/// @brief Represents HTTP POST request with JSON body.
///
/// In addition to the requirements specified by the @ref PostHttpRequest
using PostHttpRequestBytesPtr = boost::shared_ptr<PostHttpRequestBytes>;
-ThreadPool<function<void()>> THREAD_POOL;
-
} // namespace
extern "C" {
"Dhcp4": {
"control-sockets": [
{
- "socket-address": "0.0.0.0",
+ "socket-address": ")" + ADDRESS + R"(",
"socket-port": )" + PORT_STR + R"(,
"socket-type": "http"
}
],
"lease-database": {
"name": ")" + KEA_DHCP4_CSV + R"(",
+ "persist": false,
"type": "memfile"
}
}
ControlledDhcpv4Srv server;
server.init(KEA_DHCP4_CONF);
- string const address("127.0.0.1");
- int const port(18000);
- int const timeout(100000);
-
- CmdHttpListener listener(IOAddress(address), port);
- MultiThreadingMgr::instance().setMode(true);
-
- // Start the server.
- listener.start();
-
- // Create a client and specify the URL on which the server can be reached.
- IOServicePtr io_service(new IOService());
- IntervalTimer run_io_service_timer(io_service);
- HttpClient client(io_service, false);
+ HttpClient client(ControlledDhcpv4Srv::getInstance()->getIOService(), false);
stringstream ss;
- ss << "http://" << address << ":" << port;
+ ss << "http://" << ADDRESS << ":" << PORT_STR;
Url url(ss.str());
// Initiate request to the server.
string const&) {
});
- // Actually trigger the requests. The requests should be handlded by the
- // server one after another. While the first request is being processed
- // the server should queue another one.
- io_service->getInternalIOService().reset();
- run_io_service_timer.setup(&timeoutHandler, timeout, IntervalTimer::ONE_SHOT);
- io_service->runOne();
- io_service->getInternalIOService().reset();
- io_service->poll();
+ ControlledDhcpv4Srv::getInstance()->getIOService()->poll();
// Make sure that the received responses are different. We check that by
// comparing value of the sequence parameters.
cout << "no response" << endl;
}
}
- listener.stop();
client.stop();
- run_io_service_timer.cancel();
- io_service->poll();
+ ControlledDhcpv4Srv::getInstance()->getIOService()->poll();
MultiThreadingMgr::instance().setMode(false);
return 0;
static int const PORT(getpid() % 1000 + 2000);
static string const PID_STR(to_string(PID));
static string const PORT_STR(to_string(PORT));
+static string const ADDRESS("::");
static string const KEA_DHCP6_CONF(KEA_FUZZ_DIR + "/kea-dhcp6-" + PID_STR + ".conf");
static string const KEA_DHCP6_CSV(KEA_FUZZ_DIR + "/kea-dhcp6-" + PID_STR + ".csv");
-void timeoutHandler() {
- cerr << "Timeout occurred while fuzzing!" << endl;
- abort();
-}
-
/// @brief Represents HTTP POST request with JSON body.
///
/// In addition to the requirements specified by the @ref PostHttpRequest
using PostHttpRequestBytesPtr = boost::shared_ptr<PostHttpRequestBytes>;
-ThreadPool<function<void()>> THREAD_POOL;
-
} // namespace
extern "C" {
"Dhcp6": {
"control-sockets": [
{
- "socket-address": "0.0.0.0",
+ "socket-address": ")" + ADDRESS + R"(",
"socket-port": )" + PORT_STR + R"(,
"socket-type": "http"
}
],
"lease-database": {
"name": ")" + KEA_DHCP6_CSV + R"(",
+ "persist": false,
"type": "memfile"
},
"server-id": {
ControlledDhcpv6Srv server;
server.init(KEA_DHCP6_CONF);
- string const address("127.0.0.1");
- int const port(18000);
- int const timeout(100000);
-
- CmdHttpListener listener(IOAddress(address), port);
- MultiThreadingMgr::instance().setMode(true);
-
- // Start the server.
- listener.start();
-
- // Create a client and specify the URL on which the server can be reached.
- IOServicePtr io_service(new IOService());
- IntervalTimer run_io_service_timer(io_service);
- HttpClient client(io_service, false);
+ HttpClient client(ControlledDhcpv6Srv::getInstance()->getIOService(), false);
stringstream ss;
- ss << "http://" << address << ":" << port;
+ ss << "http://[" << ADDRESS << "]:" << PORT_STR;
Url url(ss.str());
// Initiate request to the server.
string const&) {
});
- // Actually trigger the requests. The requests should be handlded by the
- // server one after another. While the first request is being processed
- // the server should queue another one.
- io_service->getInternalIOService().reset();
- run_io_service_timer.setup(&timeoutHandler, timeout, IntervalTimer::ONE_SHOT);
- io_service->runOne();
- io_service->getInternalIOService().reset();
- io_service->poll();
+ ControlledDhcpv6Srv::getInstance()->getIOService()->poll();
// Make sure that the received responses are different. We check that by
// comparing value of the sequence parameters.
cout << "no response" << endl;
}
}
- listener.stop();
client.stop();
- run_io_service_timer.cancel();
- io_service->poll();
+ ControlledDhcpv6Srv::getInstance()->getIOService()->poll();
MultiThreadingMgr::instance().setMode(false);
return 0;
static string const SOCKET(KEA_FUZZ_DIR + "/kea-dhcp4-ctrl-" + PID_STR + ".sock");
static UnixControlClient CLIENT;
-static IOServicePtr IO_SERVICE(new IOService());
} // namespace
},
"lease-database": {
"name": ")" + KEA_DHCP4_CSV + R"(",
+ "persist": false,
"type": "memfile"
}
}
static string const SOCKET(KEA_FUZZ_DIR + "/kea-dhcp6-ctrl-" + PID_STR + ".sock");
static UnixControlClient CLIENT;
-static IOServicePtr IO_SERVICE(new IOService());
} // namespace
},
"lease-database": {
"name": ")" + KEA_DHCP6_CSV + R"(",
+ "persist": false,
"type": "memfile"
},
"server-id": {
ostringstream ep;
if (current_config_) {
use_https = !current_config_->getCertFile().empty();
- ep << " bound to address " << current_config_->getSocketAddress()
+ ep << "bound to address " << current_config_->getSocketAddress()
<< " port " << current_config_->getSocketPort();
}
LOG_INFO(command_logger, HTTP_COMMAND_MGR_SERVICE_STOPPING)