From: Jelte Jansen Date: Mon, 9 Jul 2012 19:06:26 +0000 (+0200) Subject: [1986] Add logging and doxygen about internal ddnsforwarder X-Git-Tag: trac2351_base~137^2~4^2~26^2~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64d089fdc9afb69b581892764e8cccd47d958013;p=thirdparty%2Fkea.git [1986] Add logging and doxygen about internal ddnsforwarder --- diff --git a/src/bin/auth/auth_messages.mes b/src/bin/auth/auth_messages.mes index 61de3ee0f5..7e15f576e2 100644 --- a/src/bin/auth/auth_messages.mes +++ b/src/bin/auth/auth_messages.mes @@ -235,6 +235,13 @@ This is a debug message indicating that the authoritative server has found that the data source it is loading is an SQLite3 data source, so no further validation is needed. +% AUTH_START_DDNS_FORWARDER DDNS UPDATE handling started +This is a debug message indicating that b10-auth has received a message +that it should internally forward UPDATE message to b10-ddns. When b10-ddns +is not running, b10-auth will respond to UPDATE requests with rcode NOTIMP. +When b10-ddns is running, b10-ddns will handle and respond to the UPDATE +message. + % AUTH_STATS_CHANNEL_CREATED STATS session channel created This is a debug message indicating that the authoritative server has created a channel to the statistics process. It is issued during server @@ -266,6 +273,15 @@ This is a debug message indicating that the statistics timer has been enabled and that the authoritative server will produce statistics data at the specified interval. +% AUTH_STOP_DDNS_FORWARDER DDNS UPDATE handling stopped +This is a debug message indicating that b10-auth has received a message +that it should stop internally forwarding UPDATE message to b10-ddns. +b10-auth will no longer forward UPDATE messages to b10-ddns, but will +respond itself with error code NOTIMP. +This message is also logged when the forwarding is restarted (for instance +if b10-ddns is restarted and the internal connection needs to be created +again), in which case it should be followed by AUTH_START_DDNS_FORWARDER. + % AUTH_UNSUPPORTED_OPCODE unsupported opcode: %1 This is a debug message, produced when a received DNS packet being processed by the authoritative server has been found to contain an diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc index a760ef3a48..f51bf59f07 100644 --- a/src/bin/auth/auth_srv.cc +++ b/src/bin/auth/auth_srv.cc @@ -900,13 +900,18 @@ AuthSrvImpl::createDDNSForwarder() { if (hasDDNSForwarder()) { destroyDDNSForwarder(); } - ddns_forwarder_ = new SocketSessionForwarderHolder("update", ddns_base_forwarder_); + LOG_DEBUG(auth_logger, DBG_AUTH_OPS, AUTH_START_DDNS_FORWARDER); + ddns_forwarder_ = new SocketSessionForwarderHolder("update", + ddns_base_forwarder_); } void AuthSrvImpl::destroyDDNSForwarder() { - delete ddns_forwarder_; - ddns_forwarder_ = NULL; + if (ddns_forwarder_ != NULL) { + LOG_DEBUG(auth_logger, DBG_AUTH_OPS, AUTH_STOP_DDNS_FORWARDER); + delete ddns_forwarder_; + ddns_forwarder_ = NULL; + } } bool diff --git a/src/bin/auth/auth_srv.h b/src/bin/auth/auth_srv.h index 72caf92dcf..2ccf245d3c 100644 --- a/src/bin/auth/auth_srv.h +++ b/src/bin/auth/auth_srv.h @@ -418,9 +418,23 @@ public: void setTSIGKeyRing(const boost::shared_ptr* keyring); - /// \brief Tells the server DDNS update packets can be forwarded internally - /// + /// \brief Create the internal forwarder for DDNS update messages + /// + /// Until this method is called (it is called when the + /// start_ddns_forwarder command is sent to b10-auth), b10-auth will + /// respond to UPDATE packets with a NOTIMP rcode. + /// If the internal forwarder was already created, it is destroyed and + /// created again. This is useful for instance when b10-ddns is shut + /// down and restarted. void createDDNSForwarder(); + + /// \brief Destroy the internal forwarder for DDNS update messages + /// + /// After this method has been called (it is called when the + /// stop_ddns_forwarder command is sent to b10-auth), DDNS Update + /// messages are no longer forwarded internally, but b10-auth will + /// immediately respond with a NOTIMP rcode. + /// If there was no forwarder yet, this method does nothing. void destroyDDNSForwarder(); private: diff --git a/src/bin/auth/common.cc b/src/bin/auth/common.cc index 2c21895b4a..26466da3c0 100644 --- a/src/bin/auth/common.cc +++ b/src/bin/auth/common.cc @@ -57,3 +57,4 @@ getDDNSSocketPath() { } const char* const AUTH_NAME = "b10-auth"; +const char* const AUTH_STARTED_NOTIFICATION = "auth_started"; diff --git a/src/bin/auth/common.h b/src/bin/auth/common.h index 9a1942c924..0964217336 100644 --- a/src/bin/auth/common.h +++ b/src/bin/auth/common.h @@ -57,6 +57,11 @@ std::string getDDNSSocketPath(); /// This is currently b10-auth, but it can be changed easily in one place. extern const char* const AUTH_NAME; +/// \brief Notification string that is used to inform auth is starting +/// +/// This is sent to interested modules (currently only b10-ddns) +extern const char* const AUTH_STARTED_NOTIFICATION; + #endif // __COMMON_H // Local Variables: diff --git a/src/bin/auth/main.cc b/src/bin/auth/main.cc index 3bfcbc5cf5..fc3b6b630f 100644 --- a/src/bin/auth/main.cc +++ b/src/bin/auth/main.cc @@ -212,7 +212,10 @@ main(int argc, char* argv[]) { LOG_INFO(auth_logger, AUTH_SERVER_STARTED); // Ping any interested module that (a new) auth is up - cc_session->group_sendmsg(isc::config::createCommand("auth_started"), "DDNS"); + // Currently, only the DDNS module is notified, but we could consider + // make an announcement channel for these (one-way) messages + cc_session->group_sendmsg( + isc::config::createCommand(AUTH_STARTED_NOTIFICATION), "DDNS"); io_service.run(); } catch (const std::exception& ex) {