face: Disable IPv4-mapping of IPv6 addresses in TCP and UDP channels
Change-Id: I9997ed4114b9708778ee55f82f567264dede6798
Refs: #1352
diff --git a/daemon/face/tcp-channel.cpp b/daemon/face/tcp-channel.cpp
index 35ade3b..4b46ea9 100644
--- a/daemon/face/tcp-channel.cpp
+++ b/daemon/face/tcp-channel.cpp
@@ -32,6 +32,10 @@
m_acceptor = make_shared<ip::tcp::acceptor>(boost::ref(getGlobalIoService()));
m_acceptor->open(m_localEndpoint.protocol());
m_acceptor->set_option(ip::tcp::acceptor::reuse_address(true));
+ if (m_localEndpoint.address().is_v6())
+ {
+ m_acceptor->set_option(ip::v6_only(true));
+ }
m_acceptor->bind(m_localEndpoint);
m_acceptor->listen(backlog);
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index cedb033..a9e24f7 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -27,6 +27,10 @@
m_socket = make_shared<ip::udp::socket>(boost::ref(getGlobalIoService()));
m_socket->open(m_localEndpoint.protocol());
m_socket->set_option(boost::asio::ip::udp::socket::reuse_address(true));
+ if (m_localEndpoint.address().is_v6())
+ {
+ m_socket->set_option(ip::v6_only(true));
+ }
try {
m_socket->bind(m_localEndpoint);