BIND 10 trac2765, updated. 65238e01cb0390c23e4937ed7710e968514fb858 [2765] Pass error handler when opening sockets in the constructor.
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Nov 29 17:55:03 UTC 2013
The branch, trac2765 has been updated
via 65238e01cb0390c23e4937ed7710e968514fb858 (commit)
via 00d6ca046beb9f2e494043d4bc1397859d554f6f (commit)
from 331b10dc0682b41939e9a184e3c4a2cc9b132803 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 65238e01cb0390c23e4937ed7710e968514fb858
Author: Marcin Siodelski <marcin at isc.org>
Date: Fri Nov 29 18:54:48 2013 +0100
[2765] Pass error handler when opening sockets in the constructor.
commit 00d6ca046beb9f2e494043d4bc1397859d554f6f
Author: Marcin Siodelski <marcin at isc.org>
Date: Fri Nov 29 18:45:38 2013 +0100
[2765] Initialize variable used in unit test to prevent compilation failure
-----------------------------------------------------------------------
Summary of changes:
src/bin/dhcp4/dhcp4_srv.cc | 11 ++++++++---
src/lib/dhcp/tests/pkt_filter_unittest.cc | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc
index 8a73b1a..0af9ec2 100644
--- a/src/bin/dhcp4/dhcp4_srv.cc
+++ b/src/bin/dhcp4/dhcp4_srv.cc
@@ -108,10 +108,15 @@ Dhcpv4Srv::Dhcpv4Srv(uint16_t port, const char* dbconfig, const bool use_bcast,
// will be able to respond directly.
IfaceMgr::instance().setMatchingPacketFilter(direct_response_desired);
+ // Open sockets only if port is non-zero. Port 0 is used
+ // for non-socket related testing.
if (port) {
- // open sockets only if port is non-zero. Port 0 is used
- // for non-socket related testing.
- IfaceMgr::instance().openSockets4(port_, use_bcast_);
+ // Create error handler. This handler will be called every time
+ // the socket opening operation fails. We use this handler to
+ // log a warning.
+ isc::dhcp::IfaceMgrErrorMsgCallback error_handler =
+ boost::bind(&Dhcpv4Srv::ifaceMgrSocket4ErrorHandler, _1);
+ IfaceMgr::instance().openSockets4(port_, use_bcast_, error_handler);
}
string srvid_file = CfgMgr::instance().getDataDir() + "/" + string(SERVER_ID_FILE);
diff --git a/src/lib/dhcp/tests/pkt_filter_unittest.cc b/src/lib/dhcp/tests/pkt_filter_unittest.cc
index e677de9..eef7fea 100644
--- a/src/lib/dhcp/tests/pkt_filter_unittest.cc
+++ b/src/lib/dhcp/tests/pkt_filter_unittest.cc
@@ -58,7 +58,7 @@ TEST_F(PktFilterBaseClassTest, openFallbackSocket) {
// Now that we have the socket open, let's try to open another one. This
// should cause a binding error.
- int another_sock;
+ int another_sock = -1;
EXPECT_THROW(another_sock =
pkt_filter.openFallbackSocket(IOAddress("127.0.0.1"), PORT),
isc::dhcp::SocketConfigError)
More information about the bind10-changes
mailing list