Gloo part looks correct to me:

  
      github.com
  
  
    facebookincubator/gloo/blob/7b58938c5d87380f88a5266035dda1041d45626e/gloo/transport/tcp/device.cc#L142-L162

std::shared_ptr<transport::Device> CreateDevice(const struct attr& src) {
  struct attr attr = src;


  if (attr.iface.size() > 0) {
    // Initialize attributes using network interface name
    lookupAddrForIface(attr);
  } else {
    // Initialize attributes using hostname/IP address
    // If not already specified, use this machine's hostname
    if (attr.hostname.size() == 0) {
      std::array<char, HOST_NAME_MAX> hostname;
      auto rv = gethostname(hostname.data(), hostname.size());
      GLOO_ENFORCE_EQ(rv, 0);
      attr.hostname = hostname.data();
    }
    lookupAddrForHostname(attr);
  }


  auto device = std::make_shared<Device>(attr);
  return std::shared_ptr<transport::Device>(device);
}