Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
d94eb9c7
Commit
d94eb9c7
authored
Mar 07, 2017
by
Francis Dupont
Browse files
[master] Merged trac5145b (hooks and D2 client configs)
parents
c818fd4e
6af8efb1
Changes
38
Expand all
Hide whitespace changes
Inline
Side-by-side
src/bin/agent/ca_cfg_mgr.cc
View file @
d94eb9c7
...
...
@@ -24,7 +24,7 @@ CtrlAgentCfgContext::CtrlAgentCfgContext()
CtrlAgentCfgContext
::
CtrlAgentCfgContext
(
const
CtrlAgentCfgContext
&
orig
)
:
DCfgContextBase
(),
http_host_
(
orig
.
http_host_
),
http_port_
(
orig
.
http_port_
),
libraries_
(
orig
.
libraries
_
)
{
hooks_config_
(
orig
.
hooks_config
_
)
{
// We're copying pointers here only. The underlying data will be shared by
// old and new context. That's how shared pointers work and I see no reason
...
...
@@ -74,7 +74,7 @@ CtrlAgentCfgMgr::getConfigSummary(const uint32_t /*selection*/) {
}
// Finally, print the hook libraries names
const
hooks
::
HookLibsCollection
libs
=
ctx
->
get
Libraries
();
const
isc
::
hooks
::
HookLibsCollection
libs
=
ctx
->
get
HooksConfig
().
get
();
s
<<
", "
<<
libs
.
size
()
<<
" lib(s):"
;
for
(
auto
lib
=
libs
.
begin
();
lib
!=
libs
.
end
();
++
lib
)
{
s
<<
lib
->
first
<<
" "
;
...
...
src/bin/agent/ca_cfg_mgr.h
View file @
d94eb9c7
...
...
@@ -8,9 +8,9 @@
#define CTRL_AGENT_CFG_MGR_H
#include
<cc/data.h>
#include
<hooks/hooks_config.h>
#include
<process/d_cfg_mgr.h>
#include
<boost/pointer_cast.hpp>
#include
<hooks/libinfo.h>
namespace
isc
{
namespace
agent
{
...
...
@@ -61,7 +61,7 @@ public:
///
/// @param type type of the server being controlled
/// @return pointer to the Element that holds control-socket map (or NULL)
const
data
::
ConstElementPtr
getControlSocketInfo
(
ServerType
type
)
const
;
const
isc
::
data
::
ConstElementPtr
getControlSocketInfo
(
ServerType
type
)
const
;
/// @brief Sets information about the control socket
///
...
...
@@ -102,20 +102,20 @@ public:
return
(
http_port_
);
}
/// @brief Returns a list of hook libraries
/// @return a list of hook libraries
const
hooks
::
HookLibsCollection
&
getLibraries
()
const
{
return
(
libraries_
);
/// @brief Returns non-const reference to configured hooks libraries.
///
/// @return non-const reference to configured hooks libraries.
isc
::
hooks
::
HooksConfig
&
getHooksConfig
()
{
return
(
hooks_config_
);
}
/// @brief
S
et
s the list of
hook libraries
/// @brief
R
et
urns const reference to configured
hook
s
libraries
.
///
/// @
params libs a coolection of libraries to remember
.
void
setLibraries
(
const
hooks
::
HookLibsCollection
&
libs
)
{
libraries_
=
libs
;
/// @
return const reference to configured hooks libraries
.
const
isc
::
hooks
::
HooksConfig
&
getHooksConfig
()
const
{
return
(
hooks_config_
)
;
}
private:
/// @brief Private copy constructor
...
...
@@ -132,7 +132,7 @@ private:
CtrlAgentCfgContext
&
operator
=
(
const
CtrlAgentCfgContext
&
rhs
);
/// Socket information will be stored here (for all supported servers)
data
::
ConstElementPtr
ctrl_sockets_
[
MAX_TYPE_SUPPORTED
+
1
];
isc
::
data
::
ConstElementPtr
ctrl_sockets_
[
MAX_TYPE_SUPPORTED
+
1
];
/// Hostname the CA should listen on.
std
::
string
http_host_
;
...
...
@@ -140,8 +140,8 @@ private:
/// TCP port the CA should listen on.
uint16_t
http_port_
;
///
List of
hook libraries.
hooks
::
Hook
LibsCollection
libraries
_
;
///
@brief Configured
hook
s
libraries.
isc
::
hooks
::
Hook
sConfig
hooks_config
_
;
};
/// @brief Ctrl Agent Configuration Manager.
...
...
src/bin/agent/simple_parser.cc
View file @
d94eb9c7
...
...
@@ -107,22 +107,21 @@ AgentSimpleParser::parse(const CtrlAgentCfgContextPtr& ctx,
}
// Finally, let's get the hook libs!
hooks
::
HooksLibrariesParser
hooks_parser
;
using
namespace
isc
::
hooks
;
HooksConfig
&
libraries
=
ctx
->
getHooksConfig
();
ConstElementPtr
hooks
=
config
->
get
(
"hooks-libraries"
);
if
(
hooks
)
{
hooks_parser
.
parse
(
hooks
);
hooks_parser
.
verifyLibraries
();
hooks
::
HookLibsCollection
libs
;
hooks_parser
.
getLibraries
(
libs
);
ctx
->
setLibraries
(
libs
);
HooksLibrariesParser
hooks_parser
;
hooks_parser
.
parse
(
libraries
,
hooks
);
libraries
.
verifyLibraries
(
hooks
->
getPosition
());
}
if
(
!
check_only
)
{
// This occurs last as if it succeeds, there is no easy way
// revert it. As a result, the failure to commit a subsequent
// change causes problems when trying to roll back.
hooks_parser
.
loadLibraries
();
libraries
.
loadLibraries
();
}
}
...
...
src/bin/agent/tests/ca_cfg_mgr_unittests.cc
View file @
d94eb9c7
...
...
@@ -10,12 +10,12 @@
#include
<process/testutils/d_test_stubs.h>
#include
<process/d_cfg_mgr.h>
#include
<agent/tests/test_libraries.h>
#include
<hooks/libinfo.h>
#include
<boost/scoped_ptr.hpp>
#include
<gtest/gtest.h>
using
namespace
isc
::
agent
;
using
namespace
isc
::
data
;
using
namespace
isc
::
dhcp
;
using
namespace
isc
::
hooks
;
using
namespace
isc
::
process
;
...
...
@@ -123,11 +123,10 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) {
EXPECT_NO_THROW
(
ctx
.
setHttpPort
(
12345
));
EXPECT_NO_THROW
(
ctx
.
setHttpHost
(
"bellatrix"
));
Hook
LibsCollection
libs
;
Hook
sConfig
&
libs
=
ctx
.
getHooksConfig
()
;
string
exp_name
(
"testlib1.so"
);
ConstElementPtr
exp_param
(
new
StringElement
(
"myparam"
));
libs
.
push_back
(
make_pair
(
exp_name
,
exp_param
));
ctx
.
setLibraries
(
libs
);
libs
.
add
(
exp_name
,
exp_param
);
// Make a copy.
DCfgContextBasePtr
copy_base
(
ctx
.
clone
());
...
...
@@ -147,7 +146,7 @@ TEST(CtrlAgentCfgMgr, contextSocketInfoCopy) {
EXPECT_EQ
(
socket3
->
str
(),
copy
->
getControlSocketInfo
(
CtrlAgentCfgContext
::
TYPE_DHCP6
)
->
str
());
// Check hook libs
HookLibsCollection
libs2
=
copy
->
get
Libraries
();
const
HookLibsCollection
&
libs2
=
copy
->
get
HooksConfig
().
get
();
ASSERT_EQ
(
1
,
libs2
.
size
());
EXPECT_EQ
(
exp_name
,
libs2
[
0
].
first
);
ASSERT_TRUE
(
libs2
[
0
].
second
);
...
...
@@ -160,19 +159,18 @@ TEST(CtrlAgentCfgMgr, contextHookParams) {
CtrlAgentCfgContext
ctx
;
// By default there should be no hooks.
Hook
LibsCollection
libs
=
ctx
.
get
Libraries
();
EXPECT_TRUE
(
libs
.
empty
());
Hook
sConfig
&
libs
=
ctx
.
get
HooksConfig
();
EXPECT_TRUE
(
libs
.
get
().
empty
());
libs
.
push_back
(
std
::
make_pair
(
"libone.so"
,
ConstElementPtr
())
)
;
libs
.
push_back
(
std
::
make_pair
(
"libtwo.so"
,
Element
::
fromJSON
(
"{
\"
foo
\"
: true}"
))
)
;
libs
.
push_back
(
std
::
make_pair
(
"libthree.so"
,
Element
::
fromJSON
(
"{
\"
bar
\"
: 42}"
))
)
;
libs
.
add
(
"libone.so"
,
ConstElementPtr
());
libs
.
add
(
"libtwo.so"
,
Element
::
fromJSON
(
"{
\"
foo
\"
: true}"
));
libs
.
add
(
"libthree.so"
,
Element
::
fromJSON
(
"{
\"
bar
\"
: 42}"
));
ctx
.
setLibraries
(
libs
);
const
HooksConfig
&
stored_libs
=
ctx
.
getHooksConfig
();
EXPECT_EQ
(
3
,
stored_libs
.
get
().
size
());
HookLibsCollection
stored_libs
=
ctx
.
getLibraries
();
EXPECT_EQ
(
3
,
stored_libs
.
size
());
EXPECT_EQ
(
libs
,
stored_libs
);
// @todo add a == operator to HooksConfig
EXPECT_EQ
(
libs
.
get
(),
stored_libs
.
get
());
}
/// Control Agent configurations used in tests.
...
...
@@ -389,7 +387,7 @@ TEST_F(AgentParserTest, configParseHooks) {
// The context now should have the library specified.
CtrlAgentCfgContextPtr
ctx
=
cfg_mgr_
.
getCtrlAgentCfgContext
();
HookLibsCollection
libs
=
ctx
->
get
Libraries
();
const
HookLibsCollection
libs
=
ctx
->
get
HooksConfig
().
get
();
ASSERT_EQ
(
1
,
libs
.
size
());
EXPECT_EQ
(
string
(
BASIC_CALLOUT_LIBRARY
),
libs
[
0
].
first
);
ASSERT_TRUE
(
libs
[
0
].
second
);
...
...
src/bin/dhcp4/dhcp4_lexer.cc
View file @
d94eb9c7
This diff is collapsed.
Click to expand it.
src/bin/dhcp4/dhcp4_lexer.ll
View file @
d94eb9c7
...
...
@@ -1018,15 +1018,6 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
}
}
\"
allow-client-update\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP_DDNS:
return isc::dhcp::Dhcp4Parser::make_ALLOW_CLIENT_UPDATE(driver.loc_);
default:
return isc::dhcp::Dhcp4Parser::make_STRING("
allow-client-update
", driver.loc_);
}
}
\"
override-no-update\
" {
switch(driver.ctx_) {
case isc::dhcp::Parser4Context::DHCP_DDNS:
...
...
src/bin/dhcp4/dhcp4_parser.cc
View file @
d94eb9c7
This diff is collapsed.
Click to expand it.
src/bin/dhcp4/dhcp4_parser.h
View file @
d94eb9c7
...
...
@@ -445,40 +445,39 @@ namespace isc { namespace dhcp {
TOKEN_NCR_PROTOCOL
=
354
,
TOKEN_NCR_FORMAT
=
355
,
TOKEN_ALWAYS_INCLUDE_FQDN
=
356
,
TOKEN_ALLOW_CLIENT_UPDATE
=
357
,
TOKEN_OVERRIDE_NO_UPDATE
=
358
,
TOKEN_OVERRIDE_CLIENT_UPDATE
=
359
,
TOKEN_REPLACE_CLIENT_NAME
=
360
,
TOKEN_GENERATED_PREFIX
=
361
,
TOKEN_TCP
=
362
,
TOKEN_JSON
=
363
,
TOKEN_WHEN_PRESENT
=
364
,
TOKEN_NEVER
=
365
,
TOKEN_ALWAYS
=
366
,
TOKEN_WHEN_NOT_PRESENT
=
367
,
TOKEN_LOGGING
=
368
,
TOKEN_LOGGERS
=
369
,
TOKEN_OUTPUT_OPTIONS
=
370
,
TOKEN_OUTPUT
=
371
,
TOKEN_DEBUGLEVEL
=
372
,
TOKEN_SEVERITY
=
373
,
TOKEN_DHCP6
=
374
,
TOKEN_DHCPDDNS
=
375
,
TOKEN_TOPLEVEL_JSON
=
376
,
TOKEN_TOPLEVEL_DHCP4
=
377
,
TOKEN_SUB_DHCP4
=
378
,
TOKEN_SUB_INTERFACES4
=
379
,
TOKEN_SUB_SUBNET4
=
380
,
TOKEN_SUB_POOL4
=
381
,
TOKEN_SUB_RESERVATION
=
382
,
TOKEN_SUB_OPTION_DEF
=
383
,
TOKEN_SUB_OPTION_DATA
=
384
,
TOKEN_SUB_HOOKS_LIBRARY
=
385
,
TOKEN_SUB_DHCP_DDNS
=
386
,
TOKEN_STRING
=
387
,
TOKEN_INTEGER
=
388
,
TOKEN_FLOAT
=
389
,
TOKEN_BOOLEAN
=
390
TOKEN_OVERRIDE_NO_UPDATE
=
357
,
TOKEN_OVERRIDE_CLIENT_UPDATE
=
358
,
TOKEN_REPLACE_CLIENT_NAME
=
359
,
TOKEN_GENERATED_PREFIX
=
360
,
TOKEN_TCP
=
361
,
TOKEN_JSON
=
362
,
TOKEN_WHEN_PRESENT
=
363
,
TOKEN_NEVER
=
364
,
TOKEN_ALWAYS
=
365
,
TOKEN_WHEN_NOT_PRESENT
=
366
,
TOKEN_LOGGING
=
367
,
TOKEN_LOGGERS
=
368
,
TOKEN_OUTPUT_OPTIONS
=
369
,
TOKEN_OUTPUT
=
370
,
TOKEN_DEBUGLEVEL
=
371
,
TOKEN_SEVERITY
=
372
,
TOKEN_DHCP6
=
373
,
TOKEN_DHCPDDNS
=
374
,
TOKEN_TOPLEVEL_JSON
=
375
,
TOKEN_TOPLEVEL_DHCP4
=
376
,
TOKEN_SUB_DHCP4
=
377
,
TOKEN_SUB_INTERFACES4
=
378
,
TOKEN_SUB_SUBNET4
=
379
,
TOKEN_SUB_POOL4
=
380
,
TOKEN_SUB_RESERVATION
=
381
,
TOKEN_SUB_OPTION_DEF
=
382
,
TOKEN_SUB_OPTION_DATA
=
383
,
TOKEN_SUB_HOOKS_LIBRARY
=
384
,
TOKEN_SUB_DHCP_DDNS
=
385
,
TOKEN_STRING
=
386
,
TOKEN_INTEGER
=
387
,
TOKEN_FLOAT
=
388
,
TOKEN_BOOLEAN
=
389
};
};
...
...
@@ -993,10 +992,6 @@ namespace isc { namespace dhcp {
symbol_type
make_ALWAYS_INCLUDE_FQDN
(
const
location_type
&
l
);
static
inline
symbol_type
make_ALLOW_CLIENT_UPDATE
(
const
location_type
&
l
);
static
inline
symbol_type
make_OVERRIDE_NO_UPDATE
(
const
location_type
&
l
);
...
...
@@ -1334,12 +1329,12 @@ namespace isc { namespace dhcp {
enum
{
yyeof_
=
0
,
yylast_
=
7
33
,
///< Last index in yytable_.
yynnts_
=
30
7
,
///< Number of nonterminal symbols.
yylast_
=
7
29
,
///< Last index in yytable_.
yynnts_
=
30
6
,
///< Number of nonterminal symbols.
yyfinal_
=
24
,
///< Termination state number.
yyterror_
=
1
,
yyerrcode_
=
256
,
yyntokens_
=
13
6
///< Number of tokens.
yyntokens_
=
13
5
///< Number of tokens.
};
...
...
@@ -1394,10 +1389,9 @@ namespace isc { namespace dhcp {
95
,
96
,
97
,
98
,
99
,
100
,
101
,
102
,
103
,
104
,
105
,
106
,
107
,
108
,
109
,
110
,
111
,
112
,
113
,
114
,
115
,
116
,
117
,
118
,
119
,
120
,
121
,
122
,
123
,
124
,
125
,
126
,
127
,
128
,
129
,
130
,
131
,
132
,
133
,
134
,
135
125
,
126
,
127
,
128
,
129
,
130
,
131
,
132
,
133
,
134
};
const
unsigned
int
user_token_number_max_
=
39
0
;
const
unsigned
int
user_token_number_max_
=
3
8
9
;
const
token_number_type
undef_token_
=
2
;
if
(
static_cast
<
int
>
(
t
)
<=
yyeof_
)
...
...
@@ -1430,28 +1424,28 @@ namespace isc { namespace dhcp {
{
switch
(
other
.
type_get
())
{
case
14
9
:
// value
case
15
3
:
// map_value
case
19
1
:
// socket_type
case
200
:
// db_type
case
40
5
:
// ncr_protocol_value
case
41
4
:
// replace_client_name_value
case
14
8
:
// value
case
15
2
:
// map_value
case
19
0
:
// socket_type
case
199
:
// db_type
case
40
4
:
// ncr_protocol_value
case
41
2
:
// replace_client_name_value
value
.
copy
<
ElementPtr
>
(
other
.
value
);
break
;
case
13
5
:
// "boolean"
case
13
4
:
// "boolean"
value
.
copy
<
bool
>
(
other
.
value
);
break
;
case
13
4
:
// "floating point"
case
13
3
:
// "floating point"
value
.
copy
<
double
>
(
other
.
value
);
break
;
case
13
3
:
// "integer"
case
13
2
:
// "integer"
value
.
copy
<
int64_t
>
(
other
.
value
);
break
;
case
13
2
:
// "constant string"
case
13
1
:
// "constant string"
value
.
copy
<
std
::
string
>
(
other
.
value
);
break
;
...
...
@@ -1472,28 +1466,28 @@ namespace isc { namespace dhcp {
(
void
)
v
;
switch
(
this
->
type_get
())
{
case
14
9
:
// value
case
15
3
:
// map_value
case
19
1
:
// socket_type
case
200
:
// db_type
case
40
5
:
// ncr_protocol_value
case
41
4
:
// replace_client_name_value
case
14
8
:
// value
case
15
2
:
// map_value
case
19
0
:
// socket_type
case
199
:
// db_type
case
40
4
:
// ncr_protocol_value
case
41
2
:
// replace_client_name_value
value
.
copy
<
ElementPtr
>
(
v
);
break
;
case
13
5
:
// "boolean"
case
13
4
:
// "boolean"
value
.
copy
<
bool
>
(
v
);
break
;
case
13
4
:
// "floating point"
case
13
3
:
// "floating point"
value
.
copy
<
double
>
(
v
);
break
;
case
13
3
:
// "integer"
case
13
2
:
// "integer"
value
.
copy
<
int64_t
>
(
v
);
break
;
case
13
2
:
// "constant string"
case
13
1
:
// "constant string"
value
.
copy
<
std
::
string
>
(
v
);
break
;
...
...
@@ -1573,28 +1567,28 @@ namespace isc { namespace dhcp {
// Type destructor.
switch
(
yytype
)
{
case
14
9
:
// value
case
15
3
:
// map_value
case
19
1
:
// socket_type
case
200
:
// db_type
case
40
5
:
// ncr_protocol_value
case
41
4
:
// replace_client_name_value
case
14
8
:
// value
case
15
2
:
// map_value
case
19
0
:
// socket_type
case
199
:
// db_type
case
40
4
:
// ncr_protocol_value
case
41
2
:
// replace_client_name_value
value
.
template
destroy
<
ElementPtr
>
();
break
;
case
13
5
:
// "boolean"
case
13
4
:
// "boolean"
value
.
template
destroy
<
bool
>
();
break
;
case
13
4
:
// "floating point"
case
13
3
:
// "floating point"
value
.
template
destroy
<
double
>
();
break
;
case
13
3
:
// "integer"
case
13
2
:
// "integer"
value
.
template
destroy
<
int64_t
>
();
break
;
case
13
2
:
// "constant string"
case
13
1
:
// "constant string"
value
.
template
destroy
<
std
::
string
>
();
break
;
...
...
@@ -1621,28 +1615,28 @@ namespace isc { namespace dhcp {
super_type
::
move
(
s
);
switch
(
this
->
type_get
())
{
case
14
9
:
// value
case
15
3
:
// map_value
case
19
1
:
// socket_type
case
200
:
// db_type
case
40
5
:
// ncr_protocol_value
case
41
4
:
// replace_client_name_value
case
14
8
:
// value
case
15
2
:
// map_value
case
19
0
:
// socket_type
case
199
:
// db_type
case
40
4
:
// ncr_protocol_value
case
41
2
:
// replace_client_name_value
value
.
move
<
ElementPtr
>
(
s
.
value
);
break
;
case
13
5
:
// "boolean"
case
13
4
:
// "boolean"
value
.
move
<
bool
>
(
s
.
value
);
break
;
case
13
4
:
// "floating point"
case
13
3
:
// "floating point"
value
.
move
<
double
>
(
s
.
value
);
break
;
case
13
3
:
// "integer"
case
13
2
:
// "integer"
value
.
move
<
int64_t
>
(
s
.
value
);
break
;
case
13
2
:
// "constant string"
case
13
1
:
// "constant string"
value
.
move
<
std
::
string
>
(
s
.
value
);
break
;
...
...
@@ -1714,7 +1708,7 @@ namespace isc { namespace dhcp {
355
,
356
,
357
,
358
,
359
,
360
,
361
,
362
,
363
,
364
,
365
,
366
,
367
,
368
,
369
,
370
,
371
,
372
,
373
,
374
,
375
,
376
,
377
,
378
,
379
,
380
,
381
,
382
,
383
,
384
,
385
,
386
,
387
,
388
,
389
,
390
385
,
386
,
387
,
388
,
389
};
return
static_cast
<
token_type
>
(
yytoken_number_
[
type
]);
}
...
...
@@ -2319,12 +2313,6 @@ namespace isc { namespace dhcp {
return
symbol_type
(
token
::
TOKEN_ALWAYS_INCLUDE_FQDN
,
l
);
}
Dhcp4Parser
::
symbol_type
Dhcp4Parser
::
make_ALLOW_CLIENT_UPDATE
(
const
location_type
&
l
)
{
return
symbol_type
(
token
::
TOKEN_ALLOW_CLIENT_UPDATE
,
l
);
}
Dhcp4Parser
::
symbol_type
Dhcp4Parser
::
make_OVERRIDE_NO_UPDATE
(
const
location_type
&
l
)
{
...
...
@@ -2526,7 +2514,7 @@ namespace isc { namespace dhcp {
#line 14 "dhcp4_parser.yy" // lalr1.cc:377
}
}
// isc::dhcp
#line 25
30
"dhcp4_parser.h" // lalr1.cc:377
#line 25
18
"dhcp4_parser.h" // lalr1.cc:377
...
...
src/bin/dhcp4/dhcp4_parser.yy
View file @
d94eb9c7
...
...
@@ -155,7 +155,6 @@ using namespace std;
NCR_PROTOCOL "ncr-protocol"
NCR_FORMAT "ncr-format"
ALWAYS_INCLUDE_FQDN "always-include-fqdn"
ALLOW_CLIENT_UPDATE "allow-client-update"
OVERRIDE_NO_UPDATE "override-no-update"
OVERRIDE_CLIENT_UPDATE "override-client-update"
REPLACE_CLIENT_NAME "replace-client-name"
...
...
@@ -1487,7 +1486,6 @@ dhcp_ddns_param: enable_updates
| ncr_protocol
| ncr_format
| always_include_fqdn
| allow_client_update
| override_no_update
| override_client_update
| replace_client_name
...
...
@@ -1564,11 +1562,6 @@ always_include_fqdn: ALWAYS_INCLUDE_FQDN COLON BOOLEAN {
ctx.stack_.back()->set("always-include-fqdn", b);
};
allow_client_update: ALLOW_CLIENT_UPDATE COLON BOOLEAN {
ElementPtr b(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("allow-client-update", b);
};
override_no_update: OVERRIDE_NO_UPDATE COLON BOOLEAN {
ElementPtr b(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("override-no-update", b);
...
...
src/bin/dhcp4/json_config_parser.cc
View file @
d94eb9c7
...
...
@@ -42,6 +42,7 @@ using namespace isc;
using
namespace
isc
::
dhcp
;
using
namespace
isc
::
data
;
using
namespace
isc
::
asiolink
;
using
namespace
isc
::
hooks
;
namespace
{
...
...
@@ -431,11 +432,6 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set,
// for option definitions. This is equivalent to commiting empty container.
LibDHCP
::
setRuntimeOptionDefs
(
OptionDefSpaceContainer
());
// Some of the parsers alter the state of the system in a way that can't
// easily be undone. (Or alter it in a way such that undoing the change has
// the same risk of failure as doing the change.)
hooks
::
HooksLibrariesParser
hooks_parser
;
// Answer will hold the result.
ConstElementPtr
answer
;
// Rollback informs whether error occurred and original data
...
...
@@ -515,17 +511,17 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set,
}
if
(
config_pair
.
first
==
"hooks-libraries"
)
{
hooks_parser
.
parse
(
config_pair
.
second
);
hooks_parser
.
verifyLibraries
();
HooksLibrariesParser
hooks_parser
;
HooksConfig
&
libraries
=
srv_cfg
->
getHooksConfig
();
hooks_parser
.
parse
(
libraries
,
config_pair
.
second
);
libraries
.
verifyLibraries
(
config_pair
.
second
->
getPosition
());
continue
;
}
// Legacy DhcpConfigParser stuff below
if
(
config_pair
.
first
==
"dhcp-ddns"
)
{
// Apply defaults if not in short cut
if
(
!
D2ClientConfigParser
::
isShortCutDisabled
(
config_pair
.
second
))
{
D2ClientConfigParser
::
setAllDefaults
(
config_pair
.
second
);
}
// Apply defaults
D2ClientConfigParser
::
setAllDefaults
(
config_pair
.
second
);
D2ClientConfigParser
parser
;
D2ClientConfigPtr
cfg
=
parser
.
parse
(
config_pair
.
second
);
srv_cfg
->
setD2ClientConfig
(
cfg
);
...
...
@@ -637,7 +633,9 @@ configureDhcp4Server(Dhcpv4Srv&, isc::data::ConstElementPtr config_set,
// This occurs last as if it succeeds, there is no easy way
// revert it. As a result, the failure to commit a subsequent
// change causes problems when trying to roll back.
hooks_parser
.
loadLibraries
();
const
HooksConfig
&
libraries
=
CfgMgr
::
instance
().
getStagingCfg
()
->
getHooksConfig
();
libraries
.
loadLibraries
();
}
catch
(
const
isc
::
Exception
&
ex
)
{
LOG_ERROR
(
dhcp4_logger
,
DHCP4_PARSER_COMMIT_FAIL
).
arg
(
ex
.
what
());
...
...
src/bin/dhcp4/location.hh
View file @
d94eb9c7
// Generated 2017030
10915
// Generated 2017030
41501
// A Bison parser, made by GNU Bison 3.0.4.
// Locations for Bison parsers in C++
...
...
src/bin/dhcp4/position.hh
View file @
d94eb9c7
// Generated 2017030
10915
// Generated 2017030
41501
// A Bison parser, made by GNU Bison 3.0.4.
// Positions for Bison parsers in C++
...
...
src/bin/dhcp4/stack.hh
View file @
d94eb9c7
// Generated 2017030
10915
// Generated 2017030
41501
// A Bison parser, made by GNU Bison 3.0.4.
// Stack handling for Bison parsers in C++
...
...