comm: do not use localhop for SVS
SVS does not work with localhop; Sync Interests need to
be forwarded at the network layer to all nodes in the group.
Change-Id: I32cba55f98f5a77257dd249d1b7c92d78460b39b
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index b9ab454..33ae4a0 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, The University of Memphis,
+ * Copyright (c) 2014-2023, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -212,6 +212,38 @@
bool
ConfFileProcessor::processConfSectionGeneral(const ConfigSection& section)
{
+ // sync-protocol
+ std::string syncProtocol = section.get<std::string>("sync-protocol", "psync");
+ if (syncProtocol == "chronosync") {
+#ifdef HAVE_CHRONOSYNC
+ m_confParam.setSyncProtocol(SyncProtocol::CHRONOSYNC);
+#else
+ std::cerr << "NLSR was compiled without ChronoSync support!\n";
+ return false;
+#endif
+ }
+ else if (syncProtocol == "psync") {
+#ifdef HAVE_PSYNC
+ m_confParam.setSyncProtocol(SyncProtocol::PSYNC);
+#else
+ std::cerr << "NLSR was compiled without PSync support!\n";
+ return false;
+#endif
+ }
+ else if (syncProtocol == "svs") {
+#ifdef HAVE_SVS
+ m_confParam.setSyncProtocol(SyncProtocol::SVS);
+#else
+ std::cerr << "NLSR was compiled without SVS support!\n";
+ return false;
+#endif
+ }
+ else {
+ std::cerr << "Sync protocol '" << syncProtocol << "' is not supported!\n"
+ << "Use 'chronosync' or 'psync' or 'svs'\n";
+ return false;
+ }
+
try {
std::string network = section.get<std::string>("network");
std::string site = section.get<std::string>("site");
@@ -283,38 +315,6 @@
return false;
}
- // sync-protocol
- std::string syncProtocol = section.get<std::string>("sync-protocol", "psync");
- if (syncProtocol == "chronosync") {
-#ifdef HAVE_CHRONOSYNC
- m_confParam.setSyncProtocol(SyncProtocol::CHRONOSYNC);
-#else
- std::cerr << "NLSR was compiled without ChronoSync support!\n";
- return false;
-#endif
- }
- else if (syncProtocol == "psync") {
-#ifdef HAVE_PSYNC
- m_confParam.setSyncProtocol(SyncProtocol::PSYNC);
-#else
- std::cerr << "NLSR was compiled without PSync support!\n";
- return false;
-#endif
- }
- else if (syncProtocol == "svs") {
-#ifdef HAVE_SVS
- m_confParam.setSyncProtocol(SyncProtocol::SVS);
-#else
- std::cerr << "NLSR was compiled without SVS support!\n";
- return false;
-#endif
- }
- else {
- std::cerr << "Sync protocol '" << syncProtocol << "' is not supported!\n"
- << "Use 'chronosync' or 'psync' or 'svs'\n";
- return false;
- }
-
// sync-interest-lifetime
uint32_t syncInterestLifetime = section.get<uint32_t>("sync-interest-lifetime",
SYNC_INTEREST_LIFETIME_DEFAULT);
diff --git a/src/conf-parameter.cpp b/src/conf-parameter.cpp
index d1c6412..81c92ca 100644
--- a/src/conf-parameter.cpp
+++ b/src/conf-parameter.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, The University of Memphis,
+ * Copyright (c) 2014-2023, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -96,7 +96,9 @@
{
m_network = networkName;
- m_syncPrefix.append("localhop");
+ if (m_syncProtocol != SyncProtocol::SVS) {
+ m_syncPrefix.append("localhop");
+ }
m_syncPrefix.append(m_network);
m_syncPrefix.append("nlsr");
m_syncPrefix.append("sync");