summaryrefslogtreecommitdiff
path: root/include/obmc_console.hpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@linux.intel.com>2018-12-19 02:57:06 +0300
committerVernon Mauery <vernon.mauery@linux.intel.com>2019-01-09 22:07:38 +0300
commita870486d56be37d552066ca87fa1aa871db54140 (patch)
tree349a91fe8a76d8f54447774b6cce032a06e4d651 /include/obmc_console.hpp
parentf6150403cc5ff5fc69d5f9dca4d305c4aaac933e (diff)
downloadbmcweb-a870486d56be37d552066ca87fa1aa871db54140.tar.xz
bmcweb: remove boost::asio::local::stream_protocol::endpoint hack
With the obmc-console-server binding to the correct socket, this is not needed. Abstract unix sockets start with the nul-charater, but are not nul terminated. In fact, the nul-character has no meaning in the path. According to the man page unix(7), abstract: an abstract socket address is distinguished (from a pathname socket) by the fact that sun_path[0] is a null byte ('\0'). The socket's address in this namespace is given by the additional bytes in sun_path that are covered by the specified length of the address structure. (Null bytes in the name have no special significance.) This means that when calling bind/connect, the size of the sockaddr structure is not sizeof(sockaddr_un), it is sizeof(sockaddr_un) - sizeof(sun_path) + (path_len) Change-Id: I2b19d0b9aa8e8ded9162890503c46cad95a6c7b6 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
Diffstat (limited to 'include/obmc_console.hpp')
-rw-r--r--include/obmc_console.hpp17
1 files changed, 0 insertions, 17 deletions
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index a15004ea65..a88357fbae 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -114,23 +114,6 @@ void requestRoutes(CrowApp& app)
const std::string consoleName("\0obmc-console", 13);
boost::asio::local::stream_protocol::endpoint ep(consoleName);
- // This is a hack. For whatever reason boost local endpoint has
- // a check to see if a string is null terminated, and if it is,
- // it drops the path character count by 1. For abstract
- // sockets, we need the count to be the full sizeof(s->sun_path)
- // (ie 108), even though our path _looks_ like it's null
- // terminated. This is likely a bug in asio that needs to be
- // submitted Todo(ed). so the cheat here is to break the
- // abstraction for a minute, write a 1 to the last byte, this
- // causes the check at the end of resize here:
- // https://www.boost.org/doc/libs/1_68_0/boost/asio/local/detail/impl/endpoint.ipp
- // to not decrement us unesssesarily.
- struct sockaddr_un* s =
- reinterpret_cast<sockaddr_un*>(ep.data());
- s->sun_path[sizeof(s->sun_path) - 1] = 1;
- ep.resize(sizeof(sockaddr_un));
- s->sun_path[sizeof(s->sun_path) - 1] = 0;
-
host_socket = std::make_unique<
boost::asio::local::stream_protocol::socket>(
conn.getIoService());