Skip to content

Commit 0943f50

Browse files
author
Razvan Becheriu
committed
[#3082] addressed review comments
1 parent a7e71c4 commit 0943f50

11 files changed

+62
-19
lines changed

doc/sphinx/arm/dhcp4-srv.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7818,6 +7818,8 @@ operating system, i.e. the size of the ``sun_path`` field in the
78187818
different operating systems, between 91 and 107 characters. Typical
78197819
values are 107 on Linux and 103 on FreeBSD.
78207820

7821+
Kea supports only one ``unix`` control socket in the "control-sockets" list.
7822+
78217823
Communication over the control channel is conducted using JSON
78227824
structures. See the
78237825
`Control Channel section in the Kea Developer's Guide
@@ -7914,6 +7916,9 @@ password, these values can be read from files. The syntax is extended by:
79147916
- The ``user-file`` client parameter, which, with the ``directory`` parameter,
79157917
specifies the path of a file where the user ID can be read.
79167918

7919+
Since Kea-2.7.6 Kea supports multiple HTTP/HTTPS connections.
7920+
Both IPv4 and IPv6 addresses can be used.
7921+
79177922
When files are used, they are read when the configuration is loaded,
79187923
to detect configuration errors as soon as possible.
79197924

@@ -7944,6 +7949,11 @@ to detect configuration errors as soon as possible.
79447949
"password": "1234"
79457950
} ]
79467951
}
7952+
},
7953+
{
7954+
"socket-type": "http",
7955+
"socket-address": "2010:30:40::50",
7956+
"socket-port": 8004
79477957
}
79487958
],
79497959

doc/sphinx/arm/dhcp6-srv.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7618,6 +7618,8 @@ operating system, i.e. the size of the ``sun_path`` field in the
76187618
different operating systems, between 91 and 107 characters. Typical
76197619
values are 107 on Linux and 103 on FreeBSD.
76207620

7621+
Kea supports only one ``unix`` control socket in the "control-sockets" list.
7622+
76217623
Communication over the control channel is conducted using JSON
76227624
structures. See the
76237625
`Control Channel section in the Kea Developer's Guide
@@ -7714,6 +7716,9 @@ password, these values can be read from files. The syntax is extended by:
77147716
- The ``user-file`` client parameter, which, with the ``directory`` parameter,
77157717
specifies the path of a file where the user ID can be read.
77167718

7719+
Since Kea-2.7.6 Kea supports multiple HTTP/HTTPS connections.
7720+
Both IPv4 and IPv6 addresses can be used.
7721+
77177722
When files are used, they are read when the configuration is loaded,
77187723
to detect configuration errors as soon as possible.
77197724

@@ -7744,6 +7749,11 @@ to detect configuration errors as soon as possible.
77447749
"password": "1234"
77457750
} ]
77467751
}
7752+
},
7753+
{
7754+
"socket-type": "http",
7755+
"socket-address": "10.20.30.40",
7756+
"socket-port": 8005
77477757
}
77487758
],
77497759

src/bin/agent/ca_process.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
136136

137137
uint16_t server_port = ctx->getHttpPort();
138138

139+
// Search for the specific connection and reuse the existing one if found.
139140
auto it = sockets_.find(std::make_pair(server_address, server_port));
140141
if (it != sockets_.end()) {
141142
auto listener = getHttpListener();
@@ -155,6 +156,8 @@ CtrlAgentProcess::configure(isc::data::ConstElementPtr config_set,
155156
return;
156157
}
157158

159+
// Connection not found so it needs to be created.
160+
// When TLS is enabled configure it.
158161
bool use_https = false;
159162
TlsContextPtr tls_context;
160163
if (!ctx->getCertFile().empty()) {

src/bin/agent/ca_process.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
namespace isc {
1616
namespace agent {
1717

18+
/// @brief Structure used to store HTTP/HTTPS connection data.
19+
/// (configuration, listener, etc.)
1820
struct HttpSocketInfo {
1921
/// @brief Flag which indicates if socket can be reused.
2022
bool usable_;
@@ -143,7 +145,7 @@ class CtrlAgentProcess : public process::DProcessBase {
143145
/// @return true if the process is listening.
144146
bool isListening() const;
145147

146-
/// @brief Close http control socket.
148+
/// @brief Close http control sockets.
147149
void closeCommandSockets();
148150

149151
private:
@@ -154,7 +156,7 @@ class CtrlAgentProcess : public process::DProcessBase {
154156
/// @return Number of executed handlers.
155157
size_t runIO();
156158

157-
/// @brief The HTTP/HTTPS socket configurations.
159+
/// @brief The HTTP/HTTPS socket data (configuration, listener, etc.).
158160
std::map<std::pair<isc::asiolink::IOAddress, uint16_t>, HttpSocketInfoPtr> sockets_;
159161
};
160162

src/lib/config/config_messages.mes

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,14 @@ This informational message indicates that the server has started
164164
HTTP/HTTPS service on the specified address and port for receiving
165165
control commands.
166166

167-
% HTTP_COMMAND_MGR_SERVICE_STOPPING stopping %1 service %2
167+
% HTTP_COMMAND_MGR_SERVICE_STOPPING Server is stopping %1 service %2
168168
This informational message indicates that the server has stopped
169169
HTTP/HTTPS service. When known the address and port are displayed.
170170

171-
% HTTP_COMMAND_MGR_SERVICE_STOPPING_NO_DATA stopping %1 service %2
172-
This informational message indicates that the server has stopped
173-
HTTP/HTTPS service. When known the address and port are displayed.
171+
% HTTP_COMMAND_MGR_SERVICE_STOPPING_NO_DATA Server is stopping all services including %1 service %2
172+
This informational message indicates that the server is stopping all
173+
HTTP/HTTPS services. When known the address and port are displayed for
174+
each service.
174175

175176
% HTTP_COMMAND_MGR_SERVICE_STOPPING_ALL stopping %1 service %2
176177
This informational message indicates that the server has stopped

src/lib/config/http_command_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ class HttpCommandConfig : public isc::data::UserContext,
232232
/// @brief Pointer to a HttpCommandConfig object.
233233
typedef boost::shared_ptr<HttpCommandConfig> HttpCommandConfigPtr;
234234

235+
/// @brief Structure used to store HTTP/HTTPS connection data.
236+
/// (configuration, listener, etc.)
235237
struct HttpSocketInfo {
236238
/// @brief Flag which indicates if socket can be reused.
237239
bool usable_;

src/lib/config/http_command_mgr.cc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ class HttpCommandMgrImpl {
3838
use_external_(true) {
3939
}
4040

41-
/// @brief Configure control socket from configuration.
41+
/// @brief Open http control sockets using configuration.
4242
///
43-
/// @param config Configuration of the control socket.
44-
void openCommandSocket(const isc::data::ConstElementPtr config);
43+
/// @param config Configuration information for the http control sockets.
44+
void openCommandSockets(const isc::data::ConstElementPtr config);
4545

46-
/// @brief Configure control socket from configuration.
46+
/// @brief Open http control socket using configuration.
4747
///
48-
/// @param config Configuration of the control socket.
49-
void openCommandSockets(const isc::data::ConstElementPtr config);
48+
/// Creates http/https listener, or reuses the existing one reapplying
49+
/// changes.
50+
///
51+
/// @param config Configuration information for the http control socket.
52+
void openCommandSocket(const isc::data::ConstElementPtr config);
5053

5154
/// @brief Close control socket.
5255
///
@@ -74,7 +77,7 @@ class HttpCommandMgrImpl {
7477
/// @brief Idle connection timeout.
7578
long idle_timeout_;
7679

77-
/// @brief The HTTP/HTTPS socket configurations.
80+
/// @brief The HTTP/HTTPS socket data (configuration, listener, etc.).
7881
std::map<std::pair<IOAddress, uint16_t>, HttpSocketInfoPtr> sockets_;
7982

8083
/// @brief Use external sockets flag.
@@ -117,6 +120,7 @@ HttpCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
117120
IOAddress server_address = cmd_config->getSocketAddress();
118121
uint16_t server_port = cmd_config->getSocketPort();
119122

123+
// Search for the specific connection and reuse the existing one if found.
120124
auto it = sockets_.find(std::make_pair(server_address, server_port));
121125
if (it != sockets_.end()) {
122126
if ((cmd_config->getTrustAnchor() != it->second->config_->getTrustAnchor()) ||
@@ -133,6 +137,8 @@ HttpCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
133137
return;
134138
}
135139

140+
// Connection not found so it needs to be created.
141+
// When TLS is enabled configure it.
136142
bool use_https = false;
137143
TlsContextPtr tls_context;
138144
if (!cmd_config->getCertFile().empty()) {

src/lib/config/http_command_mgr.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,15 @@ class HttpCommandMgr : public boost::noncopyable {
5454
/// @param use_external True (default) add external sockets.
5555
void addExternalSockets(bool use_external = true);
5656

57-
/// @brief Configure http control socket from configuration.
57+
/// @brief Open http control sockets using configuration.
5858
///
59-
/// @param config Configuration information for the http control socket.
59+
/// @param config Configuration information for the http control sockets.
6060
void openCommandSockets(const isc::data::ConstElementPtr config);
6161

62-
/// @brief Configure http control socket from configuration.
62+
/// @brief Open http control socket using configuration.
63+
///
64+
/// Creates http/https listener, or reuses the existing one reapplying
65+
/// changes.
6366
///
6467
/// @param config Configuration information for the http control socket.
6568
void openCommandSocket(const isc::data::ConstElementPtr config);
@@ -70,7 +73,7 @@ class HttpCommandMgr : public boost::noncopyable {
7073
/// @param remove When true remove the listeners immediately.
7174
void closeCommandSocket(HttpSocketInfoPtr info = HttpSocketInfoPtr(), bool remove = true);
7275

73-
/// @brief Close http control socket.
76+
/// @brief Close http control sockets.
7477
void closeCommandSockets();
7578

7679
/// @brief Returns a const pointer to the HTTP listener.

src/lib/config/tests/unix_command_config_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2021-2024 Internet Systems Consortium, Inc. ("ISC")
1+
// Copyright (C) 2024-2025 Internet Systems Consortium, Inc. ("ISC")
22
//
33
// This Source Code Form is subject to the terms of the Mozilla Public
44
// License, v. 2.0. If a copy of the MPL was not distributed with this

src/lib/config/unix_command_mgr.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ class UnixCommandMgrImpl {
510510

511511
/// @brief Opens acceptor service allowing the control clients to connect.
512512
///
513+
/// Creates acceptor, or reuses the existing one.
514+
///
513515
/// @param config Configuration information for the control socket.
514516
/// @throw BadSocketInfo When socket configuration is invalid.
515517
/// @throw SocketError When socket operation fails.
@@ -544,7 +546,7 @@ class UnixCommandMgrImpl {
544546
/// @brief Pool of connections.
545547
ConnectionPool connection_pool_;
546548

547-
/// @brief The UNIX sockets.
549+
/// @brief The UNIX socket data (configuration, acceptor, etc.).
548550
std::map<std::string, UnixSocketInfoPtr> sockets_;
549551

550552
/// @brief Connection timeout.
@@ -587,12 +589,14 @@ UnixCommandMgrImpl::openCommandSocket(const isc::data::ConstElementPtr config) {
587589

588590
UnixCommandConfigPtr cmd_config(new UnixCommandConfig(config));
589591

592+
// Search for the specific connection and reuse the existing one if found.
590593
auto it = sockets_.find(cmd_config->getSocketName());
591594
if (it != sockets_.end()) {
592595
it->second->usable_ = true;
593596
return;
594597
}
595598

599+
// Connection not found so it needs to be created.
596600
// First let's open lock file.
597601
std::string lock_name = cmd_config->getLockName();
598602
int lock_fd = open(lock_name.c_str(), O_RDONLY | O_CREAT, 0600);

src/lib/config/unix_command_mgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class UnixCommandMgr : public boost::noncopyable {
7171
/// @brief Opens unix control socket with parameters specified in socket_info
7272
/// (required parameters: socket-type: unix, socket-name:/unix/path).
7373
///
74+
/// Creates acceptor, or reuses the existing one.
75+
///
7476
/// @throw BadSocketInfo When socket configuration is invalid.
7577
/// @throw SocketError When socket operation fails.
7678
///

0 commit comments

Comments
 (0)