summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2016-04-05 14:50:20 +0200
committerThomas Markwalder <tmark@isc.org>2016-04-05 14:50:20 +0200
commit082f846f37cb32964c876b2bff5fcac82d1eaaf0 (patch)
treee0a0003655e53bf6853945e9e96318391bee3529 /src/lib
parent[master] Merge branch 'trac4300' (diff)
parent[4243] Distcheck failure correction (diff)
downloadkea-082f846f37cb32964c876b2bff5fcac82d1eaaf0.tar.xz
kea-082f846f37cb32964c876b2bff5fcac82d1eaaf0.zip
[master] Mitigate GCC 5.x optmizer issue in asiolink
Merged in trac4243.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/asiodns/io_fetch.cc31
-rw-r--r--src/lib/asiodns/tests/io_fetch_unittest.cc40
-rw-r--r--src/lib/asiolink/Makefile.am1
-rw-r--r--src/lib/asiolink/asio_wrapper.h67
-rw-r--r--src/lib/asiolink/interval_timer.cc9
-rw-r--r--src/lib/asiolink/io_address.cc15
-rw-r--r--src/lib/asiolink/io_endpoint.cc6
-rw-r--r--src/lib/asiolink/io_service.cc7
-rw-r--r--src/lib/asiolink/io_socket.cc8
-rw-r--r--src/lib/asiolink/tests/dummy_io_callback_unittest.cc9
-rw-r--r--src/lib/asiolink/tests/interval_timer_unittest.cc7
-rw-r--r--src/lib/asiolink/tests/io_socket_unittest.cc9
-rw-r--r--src/lib/asiolink/tests/tcp_endpoint_unittest.cc11
-rw-r--r--src/lib/asiolink/tests/tcp_socket_unittest.cc28
-rw-r--r--src/lib/asiolink/tests/udp_endpoint_unittest.cc11
-rw-r--r--src/lib/asiolink/tests/udp_socket_unittest.cc27
-rw-r--r--src/lib/dhcp/iface_mgr.cc7
-rw-r--r--src/lib/dhcp_ddns/ncr_io.cc5
-rw-r--r--src/lib/dhcp_ddns/ncr_udp.cc4
-rw-r--r--src/lib/dhcp_ddns/ncr_udp.h5
-rw-r--r--src/lib/dhcpsrv/tests/d2_udp_unittest.cc7
-rw-r--r--src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc5
-rw-r--r--src/lib/dhcpsrv/tests/timer_mgr_unittest.cc6
-rw-r--r--src/lib/dhcpsrv/timer_mgr.cc7
24 files changed, 184 insertions, 148 deletions
diff --git a/src/lib/asiodns/io_fetch.cc b/src/lib/asiodns/io_fetch.cc
index ba06669e1d..571c54fae8 100644
--- a/src/lib/asiodns/io_fetch.cc
+++ b/src/lib/asiodns/io_fetch.cc
@@ -1,23 +1,11 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-
-#include <unistd.h> // for some IPC/network system calls
-#include <netinet/in.h>
-#include <stdint.h>
-#include <sys/socket.h>
-
-#include <boost/bind.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-
-#include <boost/asio.hpp>
-#include <boost/asio/deadline_timer.hpp>
-
+#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/io_asio_socket.h>
#include <asiolink/io_endpoint.h>
@@ -26,17 +14,22 @@
#include <asiolink/tcp_socket.h>
#include <asiolink/udp_endpoint.h>
#include <asiolink/udp_socket.h>
-
+#include <asiodns/io_fetch.h>
+#include <asiodns/logger.h>
#include <dns/messagerenderer.h>
#include <dns/opcode.h>
#include <dns/rcode.h>
-
-#include <asiodns/io_fetch.h>
-
#include <util/buffer.h>
#include <util/random/qid_gen.h>
-#include <asiodns/logger.h>
+#include <boost/bind.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <unistd.h> // for some IPC/network system calls
+#include <netinet/in.h>
+#include <stdint.h>
+#include <sys/socket.h>
using namespace boost::asio;
using namespace isc::asiolink;
diff --git a/src/lib/asiodns/tests/io_fetch_unittest.cc b/src/lib/asiodns/tests/io_fetch_unittest.cc
index 9216c2fab3..02db1e4a38 100644
--- a/src/lib/asiodns/tests/io_fetch_unittest.cc
+++ b/src/lib/asiodns/tests/io_fetch_unittest.cc
@@ -1,10 +1,27 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_address.h>
+#include <asiolink/io_endpoint.h>
+#include <asiolink/io_service.h>
+#include <asiodns/io_fetch.h>
+#include <dns/question.h>
+#include <dns/message.h>
+#include <dns/messagerenderer.h>
+#include <dns/opcode.h>
+#include <dns/name.h>
+#include <dns/rcode.h>
+#include <util/buffer.h>
+#include <util/io_utilities.h>
+
+#include <gtest/gtest.h>
+#include <boost/bind.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <algorithm>
#include <cstdlib>
@@ -14,27 +31,6 @@
#include <iterator>
#include <vector>
-#include <gtest/gtest.h>
-#include <boost/bind.hpp>
-#include <boost/date_time/posix_time/posix_time_types.hpp>
-
-#include <boost/asio.hpp>
-
-#include <util/buffer.h>
-#include <util/io_utilities.h>
-
-#include <dns/question.h>
-#include <dns/message.h>
-#include <dns/messagerenderer.h>
-#include <dns/opcode.h>
-#include <dns/name.h>
-#include <dns/rcode.h>
-
-#include <asiolink/io_address.h>
-#include <asiolink/io_endpoint.h>
-#include <asiolink/io_service.h>
-#include <asiodns/io_fetch.h>
-
using namespace boost::asio;
using namespace isc::dns;
using namespace isc::util;
diff --git a/src/lib/asiolink/Makefile.am b/src/lib/asiolink/Makefile.am
index cdc0b3df37..806aef7c0f 100644
--- a/src/lib/asiolink/Makefile.am
+++ b/src/lib/asiolink/Makefile.am
@@ -18,6 +18,7 @@ lib_LTLIBRARIES = libkea-asiolink.la
libkea_asiolink_la_LDFLAGS = -no-undefined -version-info 2:0:0
libkea_asiolink_la_SOURCES = asiolink.h
+libkea_asiolink_la_SOURCES += asio_wrapper.h
libkea_asiolink_la_SOURCES += dummy_io_cb.h
libkea_asiolink_la_SOURCES += interval_timer.cc interval_timer.h
libkea_asiolink_la_SOURCES += io_address.cc io_address.h
diff --git a/src/lib/asiolink/asio_wrapper.h b/src/lib/asiolink/asio_wrapper.h
new file mode 100644
index 0000000000..09f64a92de
--- /dev/null
+++ b/src/lib/asiolink/asio_wrapper.h
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef ASIO_WRAPPER_H
+#define ASIO_WRAPPER_H 1
+
+// !!! IMPORTANT !!!!
+// This file must be included anywhere one would normally have included
+// boost/asio.hpp. Until the issue described below is resolved in some
+// other fashion asio.hpp should not be included other than through
+// this file.
+//
+// The optimizer as of gcc 5.2.0, may not reliably ensure a single value
+// returned by boost::system::system_category() within a translation unit
+// when building the header only version of the boost error handling.
+// See Trac #4243 for more details. For now we turn off optimization for
+// header only builds the under the suspect GCC versions.
+//
+// The issue arises from in-lining the above function, which returns a
+// reference to a local static variable, system_category_const. This leads
+// to situations where a construct such as the following:
+//
+// {{{
+// if (ec == boost::asio::error::would_block
+// || ec == boost::asio::error::try_again)
+// return false;
+// }}}
+//
+// which involve implicit conversion of enumerates to error_code instances
+// to not evaluate correctly. During the implicit conversion the error_code
+// instances may be assigned differeing values error_code:m_cat. This
+// causes two instances of error_code which should have been equal to
+// to not be equal.
+//
+// The problem disappers if either error handling code is not built header
+// only as this results in a single definiton of system_category() supplied
+// by libboost_system; or the error handling code is not optimized.
+//
+// We're doing the test here, rather than in configure to guard against the
+// user supplying the header only flag via environment variables.
+//
+// We opened bugs with GNU and BOOST:
+//
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69789
+// https://svn.boost.org/trac/boost/ticket/11989
+//
+// @todo Currently, 5.3.0 is the latest released versio of GCC. Version 6.0 is
+// in development and will need to be tested.
+
+#define GNU_CC_VERSION (__GNUC__ * 10000 \
+ + __GNUC_MINOR__ * 100 \
+ + __GNUC_PATCHLEVEL__)
+
+#if (defined(__GNUC__) && \
+ ((GNU_CC_VERSION >= 50200) && (GNU_CC_VERSION <= 50301)) \
+ && defined(BOOST_ERROR_CODE_HEADER_ONLY))
+#pragma GCC push_options
+#pragma GCC optimize ("O0")
+#include <boost/asio.hpp>
+#pragma GCC pop_options
+#else
+#include <boost/asio.hpp>
+#endif
+
+#endif // ASIO_WRAPPER_H
diff --git a/src/lib/asiolink/interval_timer.cc b/src/lib/asiolink/interval_timer.cc
index 3c05c65019..c173e8dca0 100644
--- a/src/lib/asiolink/interval_timer.cc
+++ b/src/lib/asiolink/interval_timer.cc
@@ -1,10 +1,13 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/interval_timer.h>
+#include <asiolink/io_service.h>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
@@ -12,10 +15,6 @@
#include <exceptions/exceptions.h>
-#include <boost/asio.hpp>
-#include <asiolink/interval_timer.h>
-#include <asiolink/io_service.h>
-
namespace isc {
namespace asiolink {
diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc
index 3416fa9452..de5cf3a351 100644
--- a/src/lib/asiolink/io_address.cc
+++ b/src/lib/asiolink/io_address.cc
@@ -1,23 +1,22 @@
-// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_address.h>
+#include <asiolink/io_error.h>
+#include <exceptions/exceptions.h>
+
+#include <boost/static_assert.hpp>
#include <unistd.h> // for some IPC/network system calls
#include <stdint.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <boost/asio.hpp>
-
-#include <exceptions/exceptions.h>
-#include <asiolink/io_address.h>
-#include <asiolink/io_error.h>
-#include <boost/static_assert.hpp>
-
using namespace boost::asio;
using boost::asio::ip::udp;
using boost::asio::ip::tcp;
diff --git a/src/lib/asiolink/io_endpoint.cc b/src/lib/asiolink/io_endpoint.cc
index ec8787f91d..d236aa809f 100644
--- a/src/lib/asiolink/io_endpoint.cc
+++ b/src/lib/asiolink/io_endpoint.cc
@@ -1,13 +1,11 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-
-#include <boost/asio.hpp>
-
+#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/io_error.h>
#include <asiolink/io_endpoint.h>
diff --git a/src/lib/asiolink/io_service.cc b/src/lib/asiolink/io_service.cc
index 5239cc1ef9..c50ffead6f 100644
--- a/src/lib/asiolink/io_service.cc
+++ b/src/lib/asiolink/io_service.cc
@@ -1,18 +1,17 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_service.h>
#include <unistd.h> // for some IPC/network system calls
#include <netinet/in.h>
#include <sys/socket.h>
-#include <boost/asio.hpp>
-#include <asiolink/io_service.h>
-
namespace isc {
namespace asiolink {
diff --git a/src/lib/asiolink/io_socket.cc b/src/lib/asiolink/io_socket.cc
index 308262f64e..f7792a9fb2 100644
--- a/src/lib/asiolink/io_socket.cc
+++ b/src/lib/asiolink/io_socket.cc
@@ -1,12 +1,12 @@
-// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#include "io_socket.h"
-
-#include <boost/asio.hpp>
+#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_socket.h>
namespace isc {
namespace asiolink {
diff --git a/src/lib/asiolink/tests/dummy_io_callback_unittest.cc b/src/lib/asiolink/tests/dummy_io_callback_unittest.cc
index f9d2089d6d..b836893710 100644
--- a/src/lib/asiolink/tests/dummy_io_callback_unittest.cc
+++ b/src/lib/asiolink/tests/dummy_io_callback_unittest.cc
@@ -1,16 +1,15 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-#include <gtest/gtest.h>
-
-#include <boost/asio.hpp>
-
+#include <asiolink/asio_wrapper.h>
#include <asiolink/dummy_io_cb.h>
+#include <gtest/gtest.h>
+
using namespace isc::asiolink;
using namespace boost::asio;
diff --git a/src/lib/asiolink/tests/interval_timer_unittest.cc b/src/lib/asiolink/tests/interval_timer_unittest.cc
index c08f332f60..54da9f8935 100644
--- a/src/lib/asiolink/tests/interval_timer_unittest.cc
+++ b/src/lib/asiolink/tests/interval_timer_unittest.cc
@@ -1,16 +1,15 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-#include <gtest/gtest.h>
-
-#include <boost/asio.hpp>
+#include <asiolink/asio_wrapper.h>
#include <asiolink/asiolink.h>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <gtest/gtest.h>
namespace {
// TODO: Consider this margin
diff --git a/src/lib/asiolink/tests/io_socket_unittest.cc b/src/lib/asiolink/tests/io_socket_unittest.cc
index d501f207da..659a6a6019 100644
--- a/src/lib/asiolink/tests/io_socket_unittest.cc
+++ b/src/lib/asiolink/tests/io_socket_unittest.cc
@@ -1,17 +1,16 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-#include <gtest/gtest.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_socket.h>
+#include <gtest/gtest.h>
#include <netinet/in.h>
-#include <boost/asio.hpp>
-#include <asiolink/io_socket.h>
-
using namespace isc::asiolink;
TEST(IOSocketTest, dummySockets) {
diff --git a/src/lib/asiolink/tests/tcp_endpoint_unittest.cc b/src/lib/asiolink/tests/tcp_endpoint_unittest.cc
index 445895ff18..0d838d4ebd 100644
--- a/src/lib/asiolink/tests/tcp_endpoint_unittest.cc
+++ b/src/lib/asiolink/tests/tcp_endpoint_unittest.cc
@@ -1,18 +1,17 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-
-#include <string>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_address.h>
+#include <asiolink/tcp_endpoint.h>
#include <gtest/gtest.h>
-#include <boost/asio.hpp>
-#include <asiolink/io_address.h>
-#include <asiolink/tcp_endpoint.h>
+#include <string>
using namespace isc::asiolink;
using namespace std;
diff --git a/src/lib/asiolink/tests/tcp_socket_unittest.cc b/src/lib/asiolink/tests/tcp_socket_unittest.cc
index a6d78a1e3e..15bb779ce5 100644
--- a/src/lib/asiolink/tests/tcp_socket_unittest.cc
+++ b/src/lib/asiolink/tests/tcp_socket_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -11,33 +11,27 @@
/// work.
#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_service.h>
+#include <asiolink/tcp_endpoint.h>
+#include <asiolink/tcp_socket.h>
+#include <util/buffer.h>
+#include <util/io_utilities.h>
-#include <string>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <gtest/gtest.h>
+#include <string>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
-
#include <algorithm>
#include <cstdlib>
#include <cstddef>
#include <vector>
-#include <gtest/gtest.h>
-
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <util/buffer.h>
-#include <util/io_utilities.h>
-
-#include <boost/asio.hpp>
-
-#include <asiolink/io_service.h>
-#include <asiolink/tcp_endpoint.h>
-#include <asiolink/tcp_socket.h>
-
using namespace boost::asio;
using namespace boost::asio::ip;
using namespace isc::util;
diff --git a/src/lib/asiolink/tests/udp_endpoint_unittest.cc b/src/lib/asiolink/tests/udp_endpoint_unittest.cc
index a2677573af..cf932f1a64 100644
--- a/src/lib/asiolink/tests/udp_endpoint_unittest.cc
+++ b/src/lib/asiolink/tests/udp_endpoint_unittest.cc
@@ -1,18 +1,17 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-
-#include <string>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_address.h>
+#include <asiolink/udp_endpoint.h>
#include <gtest/gtest.h>
-#include <boost/asio.hpp>
-#include <asiolink/io_address.h>
-#include <asiolink/udp_endpoint.h>
+#include <string>
using namespace isc::asiolink;
using namespace std;
diff --git a/src/lib/asiolink/tests/udp_socket_unittest.cc b/src/lib/asiolink/tests/udp_socket_unittest.cc
index ac1cc7e7db..0f3a81ba9f 100644
--- a/src/lib/asiolink/tests/udp_socket_unittest.cc
+++ b/src/lib/asiolink/tests/udp_socket_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -11,32 +11,27 @@
/// work.
#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_service.h>
+#include <asiolink/udp_endpoint.h>
+#include <asiolink/udp_socket.h>
+#include <util/buffer.h>
+#include <util/io_utilities.h>
-#include <string>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <gtest/gtest.h>
+#include <string>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
-
#include <algorithm>
#include <cstdlib>
#include <cstddef>
#include <vector>
-#include <gtest/gtest.h>
-
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <util/buffer.h>
-#include <util/io_utilities.h>
-
-#include <boost/asio.hpp>
-
-#include <asiolink/io_service.h>
-#include <asiolink/udp_endpoint.h>
-#include <asiolink/udp_socket.h>
using namespace boost::asio;
using namespace isc::util;
diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc
index 1d87d9416b..70561ba3bc 100644
--- a/src/lib/dhcp/iface_mgr.cc
+++ b/src/lib/dhcp/iface_mgr.cc
@@ -1,14 +1,11 @@
-// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-
-// This must be included before udp_endpoint.h
-#include <boost/asio.hpp>
-
+#include <asiolink/asio_wrapper.h>
#include <asiolink/io_error.h>
#include <asiolink/udp_endpoint.h>
#include <dhcp/dhcp4.h>
diff --git a/src/lib/dhcp_ddns/ncr_io.cc b/src/lib/dhcp_ddns/ncr_io.cc
index 83aa9f2003..a7c30c0e51 100644
--- a/src/lib/dhcp_ddns/ncr_io.cc
+++ b/src/lib/dhcp_ddns/ncr_io.cc
@@ -1,13 +1,14 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#include <config.h>
+#include <asiolink/asio_wrapper.h>
#include <dhcp_ddns/dhcp_ddns_log.h>
#include <dhcp_ddns/ncr_io.h>
-#include <boost/asio.hpp>
#include <boost/algorithm/string/predicate.hpp>
namespace isc {
diff --git a/src/lib/dhcp_ddns/ncr_udp.cc b/src/lib/dhcp_ddns/ncr_udp.cc
index ab69764cc0..048b5367f2 100644
--- a/src/lib/dhcp_ddns/ncr_udp.cc
+++ b/src/lib/dhcp_ddns/ncr_udp.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -9,8 +9,6 @@
#include <dhcp_ddns/dhcp_ddns_log.h>
#include <dhcp_ddns/ncr_udp.h>
-#include <boost/asio/ip/udp.hpp>
-#include <boost/system/error_code.hpp>
#include <boost/bind.hpp>
namespace isc {
diff --git a/src/lib/dhcp_ddns/ncr_udp.h b/src/lib/dhcp_ddns/ncr_udp.h
index e784721ac3..155b0480ec 100644
--- a/src/lib/dhcp_ddns/ncr_udp.h
+++ b/src/lib/dhcp_ddns/ncr_udp.h
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -98,7 +98,8 @@
/// NameChangeListener::invokeRecvHandler in the case of the UDP listener, or
/// NameChangeSender::invokeSendHandler in the case of UDP sender.
///
-#include <boost/asio.hpp>
+
+#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <asiolink/io_service.h>
#include <asiolink/udp_endpoint.h>
diff --git a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc
index f212bed921..6674cfd05b 100644
--- a/src/lib/dhcpsrv/tests/d2_udp_unittest.cc
+++ b/src/lib/dhcpsrv/tests/d2_udp_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -8,16 +8,15 @@
/// Note these tests are not intended to verify the actual send and receive
/// across UDP sockets. This level of testing is done in libdhcp-ddns.
-#include <boost/asio.hpp>
-#include <asiolink/io_service.h>
#include <config.h>
+#include <asiolink/asio_wrapper.h>
+#include <asiolink/io_service.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/d2_client_mgr.h>
#include <exceptions/exceptions.h>
#include <boost/function.hpp>
#include <boost/bind.hpp>
-
#include <gtest/gtest.h>
#include <sys/select.h>
diff --git a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
index 4f28224029..a01a54457c 100644
--- a/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc
@@ -5,8 +5,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
-
-#include <boost/asio.hpp>
+#include <asiolink/asio_wrapper.h>
#include <asiolink/io_address.h>
#include <dhcp/duid.h>
#include <dhcp/iface_mgr.h>
@@ -21,9 +20,9 @@
#include <util/pid_file.h>
#include <util/range_utilities.h>
#include <util/stopwatch.h>
-#include <gtest/gtest.h>
#include <boost/bind.hpp>
+#include <gtest/gtest.h>
#include <cstdlib>
#include <iostream>
diff --git a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc
index 3d6fba2287..9e606a61e3 100644
--- a/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc
+++ b/src/lib/dhcpsrv/tests/timer_mgr_unittest.cc
@@ -1,17 +1,19 @@
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#include <boost/asio.hpp>
#include <config.h>
+#include <asiolink/asio_wrapper.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/timer_mgr.h>
#include <exceptions/exceptions.h>
#include <util/stopwatch.h>
+
#include <boost/bind.hpp>
#include <gtest/gtest.h>
+
#include <sstream>
#include <unistd.h>
diff --git a/src/lib/dhcpsrv/timer_mgr.cc b/src/lib/dhcpsrv/timer_mgr.cc
index 2b7b003ec2..54ec50fb9b 100644
--- a/src/lib/dhcpsrv/timer_mgr.cc
+++ b/src/lib/dhcpsrv/timer_mgr.cc
@@ -1,10 +1,11 @@
-// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#include <boost/asio.hpp>
+#include <config.h>
+#include <asiolink/asio_wrapper.h>
#include <asiolink/io_service.h>
#include <dhcp/iface_mgr.h>
#include <dhcpsrv/dhcpsrv_log.h>
@@ -13,7 +14,9 @@
#include <util/threads/sync.h>
#include <util/threads/thread.h>
#include <util/watch_socket.h>
+
#include <boost/bind.hpp>
+
#include <utility>
using namespace isc;