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
ISC Open Source Projects
Kea
Commits
5b9c261d
Commit
5b9c261d
authored
Nov 29, 2013
by
Marcin Siodelski
Browse files
[2765] Fixed error handling in the IfaceMgr::openSockets4.
parent
3ca6b9a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp/iface_mgr.cc
View file @
5b9c261d
...
...
@@ -295,7 +295,6 @@ void IfaceMgr::stubDetectIfaces() {
bool
IfaceMgr
::
openSockets4
(
const
uint16_t
port
,
const
bool
use_bcast
,
IfaceMgrErrorMsgCallback
error_handler
)
{
int
sock
;
int
count
=
0
;
// This option is used to bind sockets to particular interfaces.
...
...
@@ -332,6 +331,7 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
continue
;
}
int
sock
=
-
1
;
// If selected interface is broadcast capable set appropriate
// options on the socket so as it can receive and send broadcast
// messages.
...
...
@@ -347,6 +347,7 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
" listen broadcast traffic on a"
" single interface"
,
error_handler
);
continue
;
}
else
{
try
{
...
...
@@ -356,6 +357,7 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
true
,
true
);
}
catch
(
const
Exception
&
ex
)
{
handleSocketConfigError
(
ex
.
what
(),
error_handler
);
continue
;
}
// Binding socket to an interface is not supported so we
...
...
@@ -373,17 +375,19 @@ IfaceMgr::openSockets4(const uint16_t port, const bool use_bcast,
false
,
false
);
}
catch
(
const
Exception
&
ex
)
{
handleSocketConfigError
(
ex
.
what
(),
error_handler
);
continue
;
}
}
if
(
sock
<
0
)
{
const
char
*
errstr
=
strerror
(
errno
);
isc_throw
(
SocketConfigError
,
"failed to open IPv4 socket"
<<
" supporting broadcast traffic, reason:"
<<
errstr
);
handleSocketConfigError
(
std
::
string
(
"failed to open IPv4 socket,"
" reason:"
)
+
errstr
,
error_handler
);
}
else
{
++
count
;
}
count
++
;
}
}
return
(
count
>
0
);
...
...
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