]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1986] Add logging and doxygen about internal ddnsforwarder
authorJelte Jansen <jelte@isc.org>
Mon, 9 Jul 2012 19:06:26 +0000 (21:06 +0200)
committerJelte Jansen <jelte@isc.org>
Mon, 9 Jul 2012 19:06:26 +0000 (21:06 +0200)
src/bin/auth/auth_messages.mes
src/bin/auth/auth_srv.cc
src/bin/auth/auth_srv.h
src/bin/auth/common.cc
src/bin/auth/common.h
src/bin/auth/main.cc

index 61de3ee0f59b25d3d0b4535e6ffcde58d69e0d6f..7e15f576e24e0f4c17d327794038c31cb192b42c 100644 (file)
@@ -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
index a760ef3a485a9e8d6381074300d240c691924710..f51bf59f074221185d9222c573369545de30ef72 100644 (file)
@@ -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
index 72caf92dcf4ccfe45344472fe76f015c751d7463..2ccf245d3c18e0ee720bd796921f515be5520a5f 100644 (file)
@@ -418,9 +418,23 @@ public:
     void setTSIGKeyRing(const boost::shared_ptr<isc::dns::TSIGKeyRing>*
                         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:
index 2c21895b4a1e47eb1769df8aeadac026f831d901..26466da3c0f387396a347efea52a6c80674b325f 100644 (file)
@@ -57,3 +57,4 @@ getDDNSSocketPath() {
 }
 
 const char* const AUTH_NAME = "b10-auth";
+const char* const AUTH_STARTED_NOTIFICATION = "auth_started";
index 9a1942c924b6be203d209eee5cd97789d128791a..0964217336fe5a644fb50ecb0901e3b57409b292 100644 (file)
@@ -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:
index 3bfcbc5cf59326418493772d09961e7e1a2cf1b7..fc3b6b630fd990e829a29df3ac8006dc8f95404f 100644 (file)
@@ -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) {