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
46471f4d
Commit
46471f4d
authored
Dec 17, 2014
by
Marcin Siodelski
Browse files
[3539] Interface Manager do selects addresses to bind sockets to.
parent
3fb6d907
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp/iface_mgr.cc
View file @
46471f4d
...
...
@@ -257,7 +257,7 @@ Iface::hasAddress(const isc::asiolink::IOAddress& address) const {
void
Iface
::
addAddress
(
const
isc
::
asiolink
::
IOAddress
&
addr
)
{
addrs_
.
push_back
(
OptionalValue
<
IOAddress
>
(
addr
,
OptionalValueState
(
fals
e
)));
addrs_
.
push_back
(
OptionalValue
<
IOAddress
>
(
addr
,
OptionalValueState
(
tru
e
)));
}
void
...
...
@@ -514,8 +514,8 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
addr
!=
addrs
.
end
();
++
addr
)
{
// Skip
all but V
4 addresses.
if
(
!
addr
->
get
().
isV4
())
{
// Skip
non-IPv
4 addresses
and thos that weren't selected.
.
if
(
!
addr
->
get
().
isV4
()
||
!
addr
->
isSpecified
()
)
{
continue
;
}
...
...
src/lib/dhcp/iface_mgr.h
View file @
46471f4d
...
...
@@ -258,7 +258,15 @@ public:
/// @return hardware type
uint16_t
getHWType
()
const
{
return
hardware_type_
;
}
/// @brief Returns all interfaces available on an interface.
/// @brief Returns all addresses available on an interface.
///
/// The returned addresses are encapsulated in the @c util::OptionalValue
/// class to be able to selectively flag some of the addresses as active
/// (when optional value is specified) or inactive (when optional value
/// is specified). If the address is marked as active, the
/// @c IfaceMgr::openSockets4 method will open socket and bind to this
/// address. Otherwise, it will not bind any socket to this address.
/// This is useful when an interface has multiple IPv4 addresses assigned.
///
/// Care should be taken to not use this collection after Iface object
/// ceases to exist. That is easy in most cases as Iface objects are
...
...
src/lib/dhcpsrv/cfg_iface.cc
View file @
46471f4d
...
...
@@ -70,9 +70,19 @@ CfgIface::openSockets(const uint16_t family, const uint16_t port,
}
else
if
(
family
==
AF_INET
)
{
iface
->
inactive4_
=
false
;
ExplicitAddressMap
::
const_iterator
addr
=
address_map_
.
find
(
iface
->
getName
());
ExplicitAddressMap
::
const_iterator
addr
=
address_map_
.
find
(
iface
->
getName
());
// If user has specified an address to listen on, let's activate
// only this address.
if
(
addr
!=
address_map_
.
end
())
{
iface
->
setActive
(
addr
->
second
,
true
);
// Otherwise, activate first one.
}
else
{
IOAddress
address
(
"0.0.0.0"
);
if
(
iface
->
getAddress4
(
address
))
{
iface
->
setActive
(
address
,
true
);
}
}
}
else
{
...
...
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