if (rcode) {
// Non-zero means we got an invalid configuration, take no further
- // action. In integrated mode, this will send a failed response back
+ // action. In integrated mode, this will send a failed response back
// to BIND10.
reconf_queue_flag_ = false;
return (answer);
queue_mgr_->stopListening();
} catch (const isc::Exception& ex) {
// It is very unlikey that we would experience an error
- // here, but theoretically possible.
+ // here, but theoretically possible.
LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_STOP_ERROR)
.arg(ex.what());
}
queue_mgr_->removeListener();
// Get the configuration parameters that affect Queue Manager.
- // @todo Need to add parameters for listener TYPE, FORMAT, address reuse
- std::string ip_address;
- uint32_t port;
- getCfgMgr()->getContext()->getParam("ip_address", ip_address);
+ const D2ParamsPtr& d2_params = getD2CfgMgr()->getD2Params();
// Warn the user if the server address is not the loopback.
/// @todo Remove this once we provide a secure mechanism.
+ std::string ip_address = d2_params->getIpAddress().toText();
if (ip_address != "127.0.0.1" && ip_address != "::1") {
LOG_WARN(dctl_logger, DHCP_DDNS_NOT_ON_LOOPBACK).arg(ip_address);
}
- getCfgMgr()->getContext()->getParam("port", port);
- isc::asiolink::IOAddress addr(ip_address);
-
// Instantiate the listener.
- queue_mgr_->initUDPListener(addr, port, dhcp_ddns::FMT_JSON, true);
+ if (d2_params->getNcrProtocol() == dhcp_ddns::NCR_UDP) {
+ queue_mgr_->initUDPListener(d2_params->getIpAddress(),
+ d2_params->getPort(),
+ d2_params->getNcrFormat(), true);
+ } else {
+ /// @todo Add TCP/IP once it's supported
+ // We should never get this far but if we do deal with it.
+ isc_throw(DProcessBaseError, "Unsupported NCR listener protocol:"
+ << dhcp_ddns::ncrProtocolToString(d2_params->
+ getNcrProtocol()));
+ }
// Now start it. This assumes that starting is a synchronous,
// blocking call that executes quickly. @todo Should that change then
// we will have to expand the state model to accommodate this.
queue_mgr_->startListening();
} catch (const isc::Exception& ex) {
- // Queue manager failed to initialize and therefore not listening.
- // This is most likely due to an unavailable IP address or port,
+ // Queue manager failed to initialize and therefore not listening.
+ // This is most likely due to an unavailable IP address or port,
// which is a configuration issue.
LOG_ERROR(dctl_logger, DHCP_DDNS_QUEUE_MGR_START_ERROR).arg(ex.what());
}
}
isc::data::ConstElementPtr
-D2Process::command(const std::string& command,
+D2Process::command(const std::string& command,
isc::data::ConstElementPtr args) {
// @todo This is the initial implementation. If and when D2 is extended
// to support its own commands, this implementation must change. Otherwise
/// @brief Valid configuration containing an unavailable IP address.
const char* bad_ip_d2_config = "{ "
- "\"interface\" : \"eth1\" , "
"\"ip_address\" : \"1.1.1.1\" , "
"\"port\" : 5031, "
"\"tsig_keys\": ["
/// loopback.
TEST_F(D2ProcessTest, notLoopbackTest) {
const char* config = "{ "
- "\"interface\" : \"\" , "
"\"ip_address\" : \"0.0.0.0\" , "
"\"port\" : 53001, "
"\"tsig_keys\": [],"
/// DHCP_DDNS_NOT_ON_LOOPBACK is not issued.
TEST_F(D2ProcessTest, v4LoopbackTest) {
const char* config = "{ "
- "\"interface\" : \"\" , "
"\"ip_address\" : \"127.0.0.1\" , "
"\"port\" : 53001, "
"\"tsig_keys\": [],"
/// DHCP_DDNS_NOT_ON_LOOPBACK is not issued.
TEST_F(D2ProcessTest, v6LoopbackTest) {
const char* config = "{ "
- "\"interface\" : \"\" , "
"\"ip_address\" : \"::1\" , "
"\"port\" : 53001, "
"\"tsig_keys\": [],"