Skip to content
GitLab
Menu
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
61667bcc
Commit
61667bcc
authored
Jun 25, 2012
by
Stephen Morris
Browse files
[1957] Corrected spaces between operators and a few comments.
parent
0e1996af
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp/iface_mgr.cc
View file @
61667bcc
...
...
@@ -198,7 +198,7 @@ void IfaceMgr::stubDetectIfaces() {
iface
.
flag_up_
=
true
;
iface
.
flag_running_
=
true
;
//
n
ote that we claim that this is not a loopback. iface_mgr tries to open a
//
N
ote that we claim that this is not a loopback. iface_mgr tries to open a
// socket on all interaces that are up, running and not loopback. As this is
// the only interface we were able to detect, let's pretend this is a normal
// interface.
...
...
@@ -229,8 +229,8 @@ bool IfaceMgr::openSockets4(const uint16_t port) {
int
sock
;
int
count
=
0
;
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
++
iface
)
{
cout
<<
"Trying interface "
<<
iface
->
getFullName
()
<<
endl
;
...
...
@@ -242,18 +242,17 @@ bool IfaceMgr::openSockets4(const uint16_t port) {
}
AddressCollection
addrs
=
iface
->
getAddresses
();
for
(
AddressCollection
::
iterator
addr
=
addrs
.
begin
();
for
(
AddressCollection
::
iterator
addr
=
addrs
.
begin
();
addr
!=
addrs
.
end
();
++
addr
)
{
//
s
kip IPv6 addresses
//
S
kip IPv6 addresses
if
(
addr
->
getFamily
()
!=
AF_INET
)
{
continue
;
}
sock
=
openSocket
(
iface
->
getName
(),
*
addr
,
port
);
if
(
sock
<
0
)
{
if
(
sock
<
0
)
{
cout
<<
"Failed to open unicast socket."
<<
endl
;
return
(
false
);
}
...
...
@@ -269,8 +268,8 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
int
sock
;
int
count
=
0
;
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
++
iface
)
{
if
(
iface
->
flag_loopback_
||
...
...
@@ -280,7 +279,6 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
}
AddressCollection
addrs
=
iface
->
getAddresses
();
for
(
AddressCollection
::
iterator
addr
=
addrs
.
begin
();
addr
!=
addrs
.
end
();
++
addr
)
{
...
...
@@ -291,7 +289,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
}
sock
=
openSocket
(
iface
->
getName
(),
*
addr
,
port
);
if
(
sock
<
0
)
{
if
(
sock
<
0
)
{
cout
<<
"Failed to open unicast socket."
<<
endl
;
return
(
false
);
}
...
...
@@ -300,7 +298,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
// works well on Mac OS (and possibly other BSDs), but does not work
// on Linux.
if
(
!
joinMulticast
(
sock
,
iface
->
getName
(),
string
(
ALL_DHCP_RELAY_AGENTS_AND_SERVERS
)
)
)
{
string
(
ALL_DHCP_RELAY_AGENTS_AND_SERVERS
)
)
)
{
close
(
sock
);
isc_throw
(
Unexpected
,
"Failed to join "
<<
ALL_DHCP_RELAY_AGENTS_AND_SERVERS
<<
" multicast group."
);
...
...
@@ -316,7 +314,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) {
int
sock2
=
openSocket
(
iface
->
getName
(),
IOAddress
(
ALL_DHCP_RELAY_AGENTS_AND_SERVERS
),
port
);
if
(
sock2
<
0
)
{
if
(
sock2
<
0
)
{
isc_throw
(
Unexpected
,
"Failed to open multicast socket on "
<<
" interface "
<<
iface
->
getFullName
());
iface
->
delSocket
(
sock
);
// delete previously opened socket
...
...
@@ -401,8 +399,8 @@ int IfaceMgr::openSocketFromIface(const std::string& ifname,
const
uint8_t
family
)
{
int
sock
=
0
;
// Search for specified interface among detected interfaces.
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
++
iface
)
{
if
((
iface
->
getFullName
()
!=
ifname
)
&&
...
...
@@ -437,8 +435,8 @@ int IfaceMgr::openSocketFromAddress(const IOAddress& addr,
int
sock
=
0
;
// Search through detected interfaces and addresses to match
// local address we got.
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
for
(
IfaceCollection
::
iterator
iface
=
ifaces_
.
begin
();
iface
!=
ifaces_
.
end
();
++
iface
)
{
AddressCollection
addrs
=
iface
->
getAddresses
();
...
...
src/lib/dhcp/iface_mgr.h
View file @
61667bcc
...
...
@@ -378,10 +378,10 @@ public:
/// @brief Opens UDP/IP socket and binds it to interface specified.
///
/// This method differs from \ref openSocket
such
that it
allows
///
not to
specif
y
local address to which socket will be bound.
/// Instead, method searches through addresses on specified
/// interface and selects one that matches address family.
/// This method differs from \ref openSocket
in
that it
does not require
///
the
specif
ication of a
local address to which socket will be bound.
/// Instead,
the
method searches through
the
addresses on
the
specified
/// interface and selects one that matches
the
address family.
///
/// @param ifname name of the interface
/// @param port UDP port
...
...
@@ -395,8 +395,8 @@ public:
/// @brief Opens UDP/IP socket and binds to address specified
///
/// This methods differs from \ref openSocket
such
that it
allows
///
not to
specif
y
interface to which socket will be bound.
/// This methods differs from \ref openSocket
in
that it
does not require
///
the
specif
ication of the
interface to which
the
socket will be bound.
///
/// @param addr address to be bound
/// @param port UDP port
...
...
@@ -408,10 +408,10 @@ public:
/// @brief Opens UDP/IP socket to be used to connect to remote address
///
/// This method identifies local address to be used to connect
///
to
remote address specified as argument.
///
Once local address is
idetified \ref openSocket is called
/// t
o open socket and bind it to
interface, address and port.
/// This method identifies
the
local address to be used to connect
to the
/// remote address specified as argument.
Once the local address is
/// ide
n
tified
,
\ref openSocket is called
to open a socket and bind it to
/// t
he
interface, address and port.
///
/// @param remote_addr remote address to connect to
/// @param port UDP port
...
...
Write
Preview
Supports
Markdown
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