</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
{
"module_spec": {
- "module_name": "dhcp4",
+ "module_name": "Dhcp4",
"module_description": "DHCPv4 server daemon",
"config_data": [
{ "item_name": "interface",
"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
+ }
+ ]
}
]
}
}
} // 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);
}
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);
}
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,