Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
Kea
Commits
87ba16e0
Commit
87ba16e0
authored
Jul 12, 2013
by
Marcin Siodelski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[1555] Use asterisk as wildcard for all interfaces that server listens on.
parent
2221a1de
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
45 deletions
+45
-45
src/bin/dhcp4/ctrl_dhcp4_srv.h
src/bin/dhcp4/ctrl_dhcp4_srv.h
+1
-1
src/bin/dhcp4/dhcp4.spec
src/bin/dhcp4/dhcp4.spec
+2
-2
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp4/tests/config_parser_unittest.cc
+16
-16
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
+1
-1
src/bin/dhcp6/dhcp6.spec
src/bin/dhcp6/dhcp6.spec
+2
-2
src/bin/dhcp6/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/config_parser_unittest.cc
+19
-19
src/lib/dhcpsrv/dhcp_parsers.cc
src/lib/dhcpsrv/dhcp_parsers.cc
+1
-1
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
+3
-3
No files found.
src/bin/dhcp4/ctrl_dhcp4_srv.h
View file @
87ba16e0
// Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012
-2013
Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
src/bin/dhcp4/dhcp4.spec
View file @
87ba16e0
...
...
@@ -6,13 +6,13 @@
{ "item_name": "interfaces",
"item_type": "list",
"item_optional": false,
"item_default": [ "
all
" ],
"item_default": [ "
*
" ],
"list_item_spec":
{
"item_name": "interface_name",
"item_type": "string",
"item_optional": false,
"item_default": "
all
"
"item_default": "
*
"
}
} ,
...
...
src/bin/dhcp4/tests/config_parser_unittest.cc
View file @
87ba16e0
...
...
@@ -139,7 +139,7 @@ public:
/// describing an option.
std
::
string
createConfigWithOption
(
const
std
::
map
<
std
::
string
,
std
::
string
>&
params
)
{
std
::
ostringstream
stream
;
stream
<<
"{
\"
interfaces
\"
: [
\"
all
\"
],"
stream
<<
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet4
\"
: [ { "
...
...
@@ -246,7 +246,7 @@ public:
void
resetConfiguration
()
{
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
valid-lifetime
\"
: 4000, "
...
...
@@ -323,7 +323,7 @@ TEST_F(Dhcp4ParserTest, emptySubnet) {
ConstElementPtr
status
;
EXPECT_NO_THROW
(
status
=
configureDhcp4Server
(
*
srv_
,
Element
::
fromJSON
(
"{
\"
interfaces
\"
: [
\"
all
\"
],"
Element
::
fromJSON
(
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet4
\"
: [ ], "
...
...
@@ -343,7 +343,7 @@ TEST_F(Dhcp4ParserTest, subnetGlobalDefaults) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet4
\"
: [ { "
...
...
@@ -373,7 +373,7 @@ TEST_F(Dhcp4ParserTest, subnetLocal) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet4
\"
: [ { "
...
...
@@ -404,7 +404,7 @@ TEST_F(Dhcp4ParserTest, poolOutOfSubnet) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet4
\"
: [ { "
...
...
@@ -428,7 +428,7 @@ TEST_F(Dhcp4ParserTest, poolPrefixLen) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet4
\"
: [ { "
...
...
@@ -950,7 +950,7 @@ TEST_F(Dhcp4ParserTest, optionStandardDefOverride) {
// configuration does not include options configuration.
TEST_F
(
Dhcp4ParserTest
,
optionDataDefaults
)
{
ConstElementPtr
x
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1023,7 +1023,7 @@ TEST_F(Dhcp4ParserTest, optionDataTwoSpaces) {
// The definition is not required for the option that
// belongs to the 'dhcp4' option space as it is the
// standard option.
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1101,7 +1101,7 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
// at the very end (when all other parameters are configured).
// Starting stage 1. Configure sub-options and their definitions.
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1150,7 +1150,7 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
// the configuration from the stage 2 is repeated because BIND
// configuration manager sends whole configuration for the lists
// where at least one element is being modified or added.
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1246,7 +1246,7 @@ TEST_F(Dhcp4ParserTest, optionDataEncapsulate) {
// option setting.
TEST_F
(
Dhcp4ParserTest
,
optionDataInSingleSubnet
)
{
ConstElementPtr
x
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
option-data
\"
: [ {"
...
...
@@ -1318,7 +1318,7 @@ TEST_F(Dhcp4ParserTest, optionDataInSingleSubnet) {
// for multiple subnets.
TEST_F
(
Dhcp4ParserTest
,
optionDataInMultipleSubnets
)
{
ConstElementPtr
x
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
subnet4
\"
: [ { "
...
...
@@ -1598,7 +1598,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
// In the first stahe we create definitions of suboptions
// that we will add to the base option.
// Let's create some dummy options: foo and foo2.
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1651,7 +1651,7 @@ TEST_F(Dhcp4ParserTest, stdOptionDataEncapsulate) {
// We add our dummy options to this option space and thus
// they should be included as sub-options in the 'vendor-opts'
// option.
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1788,7 +1788,7 @@ TEST_F(Dhcp4ParserTest, allInterfaces) {
// but it also includes keyword 'all'. This keyword switches server into the
// mode when it listens on all interfaces regardless of what interface names
// were specified in the "interfaces" parameter.
string
config
=
"{
\"
interfaces
\"
: [
\"
eth0
\"
,
\"
all
\"
,
\"
eth1
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
eth0
\"
,
\"
*
\"
,
\"
eth1
\"
],"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
"
\"
valid-lifetime
\"
: 4000 }"
;
...
...
src/bin/dhcp6/ctrl_dhcp6_srv.cc
View file @
87ba16e0
// Copyright (C) 2012-2013
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
...
...
src/bin/dhcp6/dhcp6.spec
View file @
87ba16e0
...
...
@@ -6,13 +6,13 @@
{ "item_name": "interfaces",
"item_type": "list",
"item_optional": false,
"item_default": [ "
all
" ],
"item_default": [ "
*
" ],
"list_item_spec":
{
"item_name": "interface_name",
"item_type": "string",
"item_optional": false,
"item_default": "
all
"
"item_default": "
*
"
}
} ,
...
...
src/bin/dhcp6/tests/config_parser_unittest.cc
View file @
87ba16e0
...
...
@@ -134,7 +134,7 @@ public:
std
::
string
>&
params
)
{
std
::
ostringstream
stream
;
stream
<<
"{
\"
interfaces
\"
: [
\"
all
\"
],"
stream
<<
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -180,7 +180,7 @@ public:
void
resetConfiguration
()
{
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -331,7 +331,7 @@ TEST_F(Dhcp6ParserTest, emptySubnet) {
ConstElementPtr
status
;
EXPECT_NO_THROW
(
status
=
configureDhcp6Server
(
srv_
,
Element
::
fromJSON
(
"{
\"
interfaces
\"
: [
\"
all
\"
],"
Element
::
fromJSON
(
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -350,7 +350,7 @@ TEST_F(Dhcp6ParserTest, subnetGlobalDefaults) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -384,7 +384,7 @@ TEST_F(Dhcp6ParserTest, subnetLocal) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -422,7 +422,7 @@ TEST_F(Dhcp6ParserTest, subnetInterface) {
// There should be at least one interface
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -455,7 +455,7 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceBogus) {
// There should be at least one interface
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -486,7 +486,7 @@ TEST_F(Dhcp6ParserTest, interfaceGlobal) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -556,7 +556,7 @@ TEST_F(Dhcp6ParserTest, subnetInterfaceId) {
// parameter.
TEST_F
(
Dhcp6ParserTest
,
interfaceIdGlobal
)
{
const
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
const
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -611,7 +611,7 @@ TEST_F(Dhcp6ParserTest, poolOutOfSubnet) {
ConstElementPtr
status
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -639,7 +639,7 @@ TEST_F(Dhcp6ParserTest, poolPrefixLen) {
ConstElementPtr
x
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -1159,7 +1159,7 @@ TEST_F(Dhcp6ParserTest, optionStandardDefOverride) {
// configuration does not include options configuration.
TEST_F
(
Dhcp6ParserTest
,
optionDataDefaults
)
{
ConstElementPtr
x
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
...
...
@@ -1241,7 +1241,7 @@ TEST_F(Dhcp6ParserTest, optionDataTwoSpaces) {
// The definition is not required for the option that
// belongs to the 'dhcp6' option space as it is the
// standard option.
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1319,7 +1319,7 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
// at the very end (when all other parameters are configured).
// Starting stage 1. Configure sub-options and their definitions.
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1368,7 +1368,7 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
// the configuration from the stage 2 is repeated because BIND
// configuration manager sends whole configuration for the lists
// where at least one element is being modified or added.
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1462,7 +1462,7 @@ TEST_F(Dhcp6ParserTest, optionDataEncapsulate) {
// for multiple subnets.
TEST_F
(
Dhcp6ParserTest
,
optionDataInMultipleSubnets
)
{
ConstElementPtr
x
;
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
@@ -1705,7 +1705,7 @@ TEST_F(Dhcp6ParserTest, stdOptionDataEncapsulate) {
// In the first stahe we create definitions of suboptions
// that we will add to the base option.
// Let's create some dummy options: foo and foo2.
string
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1758,7 +1758,7 @@ TEST_F(Dhcp6ParserTest, stdOptionDataEncapsulate) {
// We add our dummy options to this option space and thus
// they should be included as sub-options in the 'vendor-opts'
// option.
config
=
"{
\"
interfaces
\"
: [
\"
all
\"
],"
config
=
"{
\"
interfaces
\"
: [
\"
*
\"
],"
"
\"
rebind-timer
\"
: 2000,"
"
\"
renew-timer
\"
: 1000,"
"
\"
option-data
\"
: [ {"
...
...
@@ -1906,7 +1906,7 @@ TEST_F(Dhcp6ParserTest, allInterfaces) {
// bu also includes keyword 'all'. This keyword switches server into the
// mode when it listens on all interfaces regardless of what interface names
// were specified in the "interfaces" parameter.
string
config
=
"{
\"
interfaces
\"
: [
\"
eth0
\"
,
\"
eth1
\"
,
\"
all
\"
],"
string
config
=
"{
\"
interfaces
\"
: [
\"
eth0
\"
,
\"
eth1
\"
,
\"
*
\"
],"
"
\"
preferred-lifetime
\"
: 3000,"
"
\"
rebind-timer
\"
: 2000, "
"
\"
renew-timer
\"
: 1000, "
...
...
src/lib/dhcpsrv/dhcp_parsers.cc
View file @
87ba16e0
...
...
@@ -34,7 +34,7 @@ namespace isc {
namespace
dhcp
{
namespace
{
const
char
*
ALL_IFACES_KEYWORD
=
"
all
"
;
const
char
*
ALL_IFACES_KEYWORD
=
"
*
"
;
}
// *********************** ParserContext *************************
...
...
src/lib/dhcpsrv/tests/dhcp_parsers_unittest.cc
View file @
87ba16e0
...
...
@@ -200,8 +200,8 @@ TEST_F(DhcpParserTest, uint32ParserTest) {
/// 1. Does not allow empty for storage.
/// 2. Does not allow name other than "interfaces"
/// 3. Parses list of interfaces and adds them to CfgMgr
/// 4. Parses
'all' keyword
and sets a CfgMgr flag which indicates
that
///
server will listen on all interfaces.
/// 4. Parses
wildcard interface name
and sets a CfgMgr flag which indicates
///
that
server will listen on all interfaces.
TEST_F
(
DhcpParserTest
,
interfaceListParserTest
)
{
const
std
::
string
name
=
"interfaces"
;
...
...
@@ -234,7 +234,7 @@ TEST_F(DhcpParserTest, interfaceListParserTest) {
// Add keyword all to the configuration. This should activate all
// interfaces, including eth2, even though it has not been explicitly
// added.
list_element
->
add
(
Element
::
create
(
"
all
"
));
list_element
->
add
(
Element
::
create
(
"
*
"
));
// Reset parser's state.
parser
.
reset
(
new
InterfaceListConfigParser
(
name
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment