face: use /run/nfd.sock on Linux
refs #5039
Change-Id: I10902725912a8f194ce6da6590378c1029955f80
diff --git a/daemon/face/unix-stream-factory.cpp b/daemon/face/unix-stream-factory.cpp
index faa406c..f024dc6 100644
--- a/daemon/face/unix-stream-factory.cpp
+++ b/daemon/face/unix-stream-factory.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2020, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -46,7 +46,8 @@
{
// unix
// {
- // path /var/run/nfd.sock
+ // path /run/nfd.sock ; on Linux
+ // path /var/run/nfd.sock ; on other platforms
// }
m_wantCongestionMarking = context.generalConfig.wantCongestionMarking;
@@ -58,7 +59,11 @@
return;
}
+#ifdef __linux__
+ std::string path = "/run/nfd.sock";
+#else
std::string path = "/var/run/nfd.sock";
+#endif // __linux__
for (const auto& pair : *configSection) {
const std::string& key = pair.first;
diff --git a/daemon/rib/service.cpp b/daemon/rib/service.cpp
index d9e5bc5..596fa27 100644
--- a/daemon/rib/service.cpp
+++ b/daemon/rib/service.cpp
@@ -73,7 +73,11 @@
{
if (config.get_child_optional("face_system.unix")) {
// default socket path should be the same as in UnixStreamFactory::processConfig
+#ifdef __linux__
+ auto path = config.get<std::string>("face_system.unix.path", "/run/nfd.sock");
+#else
auto path = config.get<std::string>("face_system.unix.path", "/var/run/nfd.sock");
+#endif // __linux__
return make_shared<ndn::UnixTransport>(path);
}
else if (config.get_child_optional("face_system.tcp") &&