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
4bac0846
Commit
4bac0846
authored
Aug 26, 2014
by
Marcin Siodelski
Browse files
[3512] Addressed review comments.
parent
578bf4d0
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp/tests/iface_mgr_unittest.cc
View file @
4bac0846
...
...
@@ -614,6 +614,7 @@ TEST_F(IfaceMgrTest, ifaceHasAddress) {
Iface
*
iface
=
IfaceMgr
::
instance
().
getIface
(
"eth0"
);
ASSERT_FALSE
(
iface
==
NULL
);
EXPECT_TRUE
(
iface
->
hasAddress
(
IOAddress
(
"10.0.0.1"
)));
EXPECT_FALSE
(
iface
->
hasAddress
(
IOAddress
(
"10.0.0.2"
)));
EXPECT_TRUE
(
iface
->
hasAddress
(
IOAddress
(
"fe80::3a60:77ff:fed5:cdef"
)));
EXPECT_TRUE
(
iface
->
hasAddress
(
IOAddress
(
"2001:db8:1::1"
)));
EXPECT_FALSE
(
iface
->
hasAddress
(
IOAddress
(
"2001:db8:1::2"
)));
...
...
src/lib/dhcpsrv/cfg_iface.cc
View file @
4bac0846
...
...
@@ -237,6 +237,13 @@ CfgIface::use(const std::string& iface_name) {
" a valid IPv6 unicast address"
);
}
// There are valid cases where link local address can be specified to
// receive unicast traffic, e.g. sent by relay agent.
if
(
addr
.
isV6LinkLocal
())
{
LOG_WARN
(
dhcpsrv_logger
,
DHCPSRV_CFGMGR_UNICAST_LINK_LOCAL
)
.
arg
(
addr
.
toText
()).
arg
(
name
);
}
// Interface must have this address assigned.
if
(
!
iface
->
hasAddress
(
addr
))
{
isc_throw
(
NoSuchAddress
,
...
...
src/lib/dhcpsrv/cfg_iface.h
View file @
4bac0846
...
...
@@ -176,17 +176,22 @@ private:
/// @brief Protocol family.
Family
family_
;
/// @brief Represents a set of interface names.
typedef
std
::
set
<
std
::
string
>
IfaceSet
;
/// @brief A set of interface names specified by the user.
IfaceSet
iface_set_
;
/// @brief A map of interfaces and unicast addresses.
typedef
std
::
map
<
std
::
string
,
asiolink
::
IOAddress
>
UnicastMap
;
/// @brief A map which holds the pairs of interface names and unicast
/// addresses for which the unicast sockets should be opened.
///
/// This is only used for V6 family.
UnicastMap
unicast_map_
;
/// @brief A booolean value which indicates that the wildcard interface name
/// has been specified (*).
bool
wildcard_used_
;
...
...
src/lib/dhcpsrv/dhcpsrv_messages.mes
View file @
4bac0846
...
...
@@ -145,6 +145,11 @@ This is a debug message reporting that the DHCP configuration manager has
returned the specified IPv6 subnet, because detected relay agent address
matches value specified for this subnet.
% DHCPSRV_CFGMGR_UNICAST_LINK_LOCAL specified link local address %1 for unicast traffic on interface %2
This warning message is logged when user specified a link-local address to
receive unicast traffic. The warning message is issued because it is an
uncommon use.
% DHCPSRV_CLOSE_DB closing currently open %1 database
This is a debug message, issued when the DHCP server closes the currently
open lease database. It is issued at program shutdown and whenever
...
...
src/lib/dhcpsrv/tests/cfg_iface_unittest.cc
View file @
4bac0846
...
...
@@ -146,7 +146,7 @@ TEST_F(CfgIfaceTest, explicitNamesV6) {
// select all interfaces to open IPv4 sockets.
TEST_F
(
CfgIfaceTest
,
wildcardV4
)
{
CfgIface
cfg
(
CfgIface
::
V4
);
ASSERT_NO_THROW
(
cfg
.
use
(
CfgIface
::
ALL_IFACES_KEYWORD
));
ASSERT_NO_THROW
(
cfg
.
use
(
"*"
));
cfg
.
openSockets
(
DHCP4_SERVER_PORT
);
...
...
@@ -165,7 +165,7 @@ TEST_F(CfgIfaceTest, wildcardV4) {
// select all interfaces to open IPv6 sockets.
TEST_F
(
CfgIfaceTest
,
wildcardV6
)
{
CfgIface
cfg
(
CfgIface
::
V6
);
ASSERT_NO_THROW
(
cfg
.
use
(
CfgIface
::
ALL_IFACES_KEYWORD
));
ASSERT_NO_THROW
(
cfg
.
use
(
"*"
));
cfg
.
openSockets
(
DHCP4_SERVER_PORT
);
...
...
@@ -219,8 +219,8 @@ TEST_F(CfgIfaceTest, invalidValues) {
ASSERT_THROW
(
cfg
.
use
(
"eth0/fe80::3a60:77ff:fed5:cdef"
),
InvalidIfaceName
);
ASSERT_THROW
(
cfg
.
use
(
"eth0/2001:db8:1::2"
),
NoSuchAddress
);
ASSERT_NO_THROW
(
cfg
.
use
(
CfgIface
::
ALL_IFACES_KEYWORD
));
ASSERT_THROW
(
cfg
.
use
(
CfgIface
::
ALL_IFACES_KEYWORD
),
DuplicateIfaceName
);
ASSERT_NO_THROW
(
cfg
.
use
(
"*"
));
ASSERT_THROW
(
cfg
.
use
(
"*"
),
DuplicateIfaceName
);
}
}
// end of anonymous namespace
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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