BIND 10 trac1651, updated. 977c4a2b576986ab0e7402cb0ade14244bf90ca2 [1651] Small command handling improvements.

BIND 10 source code commits bind10-changes at lists.isc.org
Fri May 11 15:40:18 UTC 2012


The branch, trac1651 has been updated
       via  977c4a2b576986ab0e7402cb0ade14244bf90ca2 (commit)
      from  77db6312d871bda380dade0f5312f9342f0de918 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 977c4a2b576986ab0e7402cb0ade14244bf90ca2
Author: Tomek Mrugalski <tomasz at isc.org>
Date:   Fri May 11 17:39:47 2012 +0200

    [1651] Small command handling improvements.

-----------------------------------------------------------------------

Summary of changes:
 doc/guide/bind10-guide.xml |   27 ++++++++++++++-------------
 src/bin/dhcp4/dhcp4.spec   |   12 +++++++++---
 src/bin/dhcp4/main.cc      |   18 +++++++++++++-----
 3 files changed, 36 insertions(+), 21 deletions(-)

-----------------------------------------------------------------------
diff --git a/doc/guide/bind10-guide.xml b/doc/guide/bind10-guide.xml
index 630c0c4..85b3909 100644
--- a/doc/guide/bind10-guide.xml
+++ b/doc/guide/bind10-guide.xml
@@ -2037,21 +2037,22 @@ then change those defaults with config set Resolver/forward_addresses[0]/address
       </para>
 
       <para>
-        The DHCPv4 server is implemented as <command>b10-dhcp4</command>
-        daemon. As it is not configurable yet, it is fully autonomous,
-        that is it does not interact with <command>b10-cfgmgr</command>.
-        To start DHCPv4 server, simply input:
-
-        <screen>
-#<userinput>cd src/bin/dhcp4</userinput>
-#<userinput>./b10-dhcp4</userinput>
-</screen>
+        <command>b10-dhcp4</command> is a BIND10 component and is being
+        run under BIND10 framework. To add a DHCPv4 process to the set of running
+        BIND10 services, you can use following commands in <command>bindctl</command>:
+        <screen>> <userinput>config add Boss/components b10-dhcp4</userinput>
+> <userinput>config set Boss/components/b10-resolver/kind dispensable</userinput>
+> <userinput>config commit</userinput></screen></para>
 
-        Depending on your installation, <command>b10-dhcp4</command>
-        binary may reside in src/bin/dhcp4 in your source code
-        directory, in /usr/local/bin/b10-dhcp4 or other directory
-        you specified during compilation.
+       <para>
+         To shutdown running <command>b10-dhcp4</command>, please use the
+         following command:
+         <screen>> <userinput>dhcp4 shutdown</userinput></screen>
+         or
+         <screen>> <userinput>config remove Boss/components b10-dhcp4</userinput>
+> <userinput>config commit</userinput></screen></para>
 
+      <para>
         At start, the server will detect available network interfaces
         and will attempt to open UDP sockets on all interfaces that
         are up, running, are not loopback, and have IPv4 address
diff --git a/src/bin/dhcp4/dhcp4.spec b/src/bin/dhcp4/dhcp4.spec
index 98df3a9..7584b48 100644
--- a/src/bin/dhcp4/dhcp4.spec
+++ b/src/bin/dhcp4/dhcp4.spec
@@ -1,6 +1,6 @@
 {
   "module_spec": {
-    "module_name": "dhcp4",
+    "module_name": "Dhcp4",
     "module_description": "DHCPv4 server daemon",
     "config_data": [
       { "item_name": "interface",
@@ -12,8 +12,14 @@
     "commands": [
         {
             "command_name": "shutdown",
-            "command_description": "Shut down DHCPv4 server",
-            "command_args": []
+            "command_description": "Shuts down DHCPv4 server.",
+            "command_args": [
+                {
+                    "item_name": "pid",
+                    "item_type": "integer",
+                    "item_optional": true
+                }
+            ]
         }
     ]
   }
diff --git a/src/bin/dhcp4/main.cc b/src/bin/dhcp4/main.cc
index cdd920c..1f8f7a0 100644
--- a/src/bin/dhcp4/main.cc
+++ b/src/bin/dhcp4/main.cc
@@ -65,11 +65,13 @@ usage() {
 }
 } // end of anonymous namespace
 
+IOService io_service;
+
 ConstElementPtr
 dhcp4_config_handler(ConstElementPtr new_config) {
     cout << "b10-dhcp4: Received new config:" << new_config->str() << endl;
     ConstElementPtr answer = isc::config::createAnswer(0,
-                             "All good here. Thanks for sending config.");
+                             "Thanks for sending config.");
     return (answer);
 }
 
@@ -77,8 +79,16 @@ ConstElementPtr
 dhcp4_command_handler(const string& command, ConstElementPtr args) {
     cout << "b10-dhcp4: Received new command: [" << command << "], args="
          << args->str() << endl;
-    ConstElementPtr answer = isc::config::createAnswer(0,
-                             "All good here. Thanks for asking.");
+    if (command == "shutdown") {
+        io_service.stop();
+        ConstElementPtr answer = isc::config::createAnswer(0,
+                                 "Shutting down.");
+        return (answer);
+    }
+
+    ConstElementPtr answer = isc::config::createAnswer(1,
+                             "Unrecognized command.");
+
     return (answer);
 }
 
@@ -98,8 +108,6 @@ void establish_session() {
 
     cout << "b10-dhcp4: my specfile is " << specfile << endl;
 
-    IOService io_service;
-
     cc_session = new Session(io_service.get_io_service());
 
     config_session = new ModuleCCSession(specfile, *cc_session,



More information about the bind10-changes mailing list