Skip to content

Commit

Permalink
Do not compile ChronoSync support by default
Browse files Browse the repository at this point in the history
ChronoSync dependency is now made optional
and is kept for testing purposes only.

Also change sig-type to ecdsa-sha256 in nlsr.conf
as ndn-cxx now has strict checking for it.

refs: #5147

Change-Id: I95c9fb844681ebf2c4e7bbb03cc7796a0795de83
  • Loading branch information
agawande committed Mar 27, 2021
1 parent 6002e6a commit 30d96e4
Show file tree
Hide file tree
Showing 21 changed files with 161 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .jenkins.d/10-build.sh
Expand Up @@ -28,7 +28,7 @@ if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
fi

# Build in debug mode with tests
./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
./waf --color=yes configure --with-chronosync --debug --with-tests $ASAN $COVERAGE
./waf --color=yes build -j$WAF_JOBS

# (tests will be run against the debug version)
Expand Down
15 changes: 10 additions & 5 deletions docs/INSTALL.rst
Expand Up @@ -12,16 +12,17 @@ Prerequisites
Refer to `Getting started with NFD <https://named-data.net/doc/NFD/current/INSTALL.html>`_
for detailed installation and running instruction.

- ChronoSync library

Download the ChronoSync library and build it according to the instructions available at
https://github.com/named-data/ChronoSync#build

- PSync library

Download the PSync library and build it according to the instructions available at
https://github.com/named-data/PSync#build

- [Optional] ChronoSync library

For testing purposes, NLSR can be optionally built with Chronosync support.
Download the ChronoSync library and build it according to the instructions available at
https://github.com/named-data/ChronoSync#build

Build
-----

Expand All @@ -40,3 +41,7 @@ configure``::
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# or
export PKG_CONFIG_PATH=/path/to/pkgconfig/on/your/machine

If ChronoSync support is desired, NLSR needs to be configured with the following option:

./waf configure --with-chronosync
57 changes: 33 additions & 24 deletions docs/beginners-guide.rst
Expand Up @@ -18,7 +18,7 @@ A beginners guide to installing and testing NLSR on Fedora
The following instructions are based on the information provided at the
Named Data Networking project web page [NDNmain]_.
Before installing NLSR it is necessary to install different libraries
and programs: ndn-cxx, NFD, ChronoSync, and PSync. This document describes the
and programs: ndn-cxx, NFD, ChronoSync [optional], and PSync. This document describes the
necessary steps to correctly install these programs (§ `2 <#ndncxx>`__,
`3 <#nfd>`__ and `4 <#nlsr>`__) and a brief guide on how to configure
and test NLSR using a simple two-node network (§ `5 <#test>`__).
Expand Down Expand Up @@ -361,20 +361,19 @@ commands:
4. Installing NLSR
==================

4.1 Installing ChronoSync
-------------------------
4.1 Installing PSync
--------------------

Before installing NLSR, it is necessary to first download and install
ChronoSync, which is a synchronization library which allows NLSR routers
to synchronize Link State Advertisements (LSAs). More information about
ChronoSync may be found at [Chronosync]_. This library may be
installed by running the following commands as a regular user and at the
directory defined at § `1 <#intro>`__:
Before installing NLSR, it is also necessary to download and install
PSync. PSync is a synchronization library which allows NLSR to synchronize LSAs
similar to ChronoSync. More information about PSync may be found at [PSync]_.
This library may be installed by running the following commands as a regular
user and at the directory defined at § `1 <#intro>`__:

::

$ git clone --depth 1 https://github.com/named-data/ChronoSync.git
$ cd ChronoSync
$ git clone --depth 1 https://github.com/named-data/PSync.git
$ cd PSync
$ ./waf configure
$ ./waf
$ sudo ./waf install
Expand All @@ -383,27 +382,31 @@ The following command needs to be used again to configure the libraries:

::

$ sudo ldconfig -v | grep -i chronosync
$ sudo ldconfig -v | grep -i psync

This command should display a line similar to the following:

::

libChronoSync.so.0.5.0 -> libChronoSync.so.0.5.0
libPSync.so.0.1.0 -> libPSync.so.0.1.0

4.2 Installing PSync
-------------------------
4.2 [Optional] Installing ChronoSync
------------------------------------

Before installing NLSR, it is also necessary to download and install
PSync. PSync is a synchronization library which allows NLSR to synchronize LSAs
similar to ChronoSync. More information about PSync may be found at [PSync]_.
This library may be installed by running the following commands as a regular
user and at the directory defined at § `1 <#intro>`__:
By default NLSR no longer builds with ChronoSync support.
Since ChronoSync is deprecated, only install it for testing purposes.

Before installing NLSR, it is necessary to first download and install
ChronoSync, which is a synchronization library which allows NLSR routers
to synchronize Link State Advertisements (LSAs). More information about
ChronoSync may be found at [Chronosync]_. This library may be
installed by running the following commands as a regular user and at the
directory defined at § `1 <#intro>`__:

::

$ git clone --depth 1 https://github.com/named-data/PSync.git
$ cd PSync
$ git clone --depth 1 https://github.com/named-data/ChronoSync.git
$ cd ChronoSync
$ ./waf configure
$ ./waf
$ sudo ./waf install
Expand All @@ -412,13 +415,13 @@ The following command needs to be used again to configure the libraries:

::

$ sudo ldconfig -v | grep -i psync
$ sudo ldconfig -v | grep -i chronosync

This command should display a line similar to the following:

::

libPSync.so.0.1.0 -> libPSync.so.0.1.0
libChronoSync.so.0.5.0 -> libChronoSync.so.0.5.0

4.3 Downloading and installing NLSR
-----------------------------------
Expand All @@ -435,6 +438,12 @@ commands need to be run as a regular user:
$ ./waf
$ sudo ./waf install

If ChronoSync support is needed for testing, please configure NLSR with:

::

$ ./waf configure --with-chronosync

4.4 Configuring NLSR
--------------------

Expand Down
14 changes: 7 additions & 7 deletions nlsr.conf
Expand Up @@ -28,7 +28,7 @@ general
state-dir /var/lib/nlsr ; path for intermediate state files including sequence directory (Absolute path)
}

; the neighbor's section contains the configuration for router's neighbors and hellos behavior
; the neighbors section contains the configuration for router's neighbors and hello protocol behavior

neighbors
{
Expand Down Expand Up @@ -144,7 +144,7 @@ security
checker
{
type customized
sig-type rsa-sha256
sig-type ecdsa-sha256
key-locator
{
type name
Expand Down Expand Up @@ -172,7 +172,7 @@ security
checker
{
type customized
sig-type rsa-sha256
sig-type ecdsa-sha256
key-locator
{
type name
Expand Down Expand Up @@ -201,7 +201,7 @@ security
checker
{
type customized
sig-type rsa-sha256
sig-type ecdsa-sha256
key-locator
{
type name
Expand Down Expand Up @@ -229,7 +229,7 @@ security
checker
{
type hierarchical
sig-type rsa-sha256
sig-type ecdsa-sha256
}
}

Expand All @@ -256,7 +256,7 @@ security
checker
{
type customized
sig-type rsa-sha256
sig-type ecdsa-sha256
key-locator
{
type name
Expand All @@ -277,7 +277,7 @@ security
checker
{
type hierarchical
sig-type rsa-sha256
sig-type ecdsa-sha256
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/communication/sync-logic-handler.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2020, The University of Memphis,
/*
* Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
Expand All @@ -26,6 +26,8 @@
#include "logger.hpp"
#include "utility/name-helper.hpp"

#include <boost/lexical_cast.hpp>

namespace nlsr {

INIT_LOGGER(SyncLogicHandler);
Expand Down
47 changes: 28 additions & 19 deletions src/communication/sync-protocol-adapter.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2018, The University of Memphis,
/*
* Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
Expand All @@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
*/

#include "sync-protocol-adapter.hpp"
#include "logger.hpp"
Expand All @@ -29,14 +29,17 @@ namespace nlsr {
const auto FIXED_SESSION = ndn::name::Component::fromNumber(0);

SyncProtocolAdapter::SyncProtocolAdapter(ndn::Face& face,
int32_t syncProtocol,
SyncProtocol syncProtocol,
const ndn::Name& syncPrefix,
const ndn::Name& userPrefix,
ndn::time::milliseconds syncInterestLifetime,
const SyncUpdateCallback& syncUpdateCallback)
: m_syncProtocol(syncProtocol)
, m_syncUpdateCallback(syncUpdateCallback)
{
NLSR_LOG_TRACE("SyncProtocol value: " << m_syncProtocol);

#ifdef HAVE_CHRONOSYNC
if (m_syncProtocol == SYNC_PROTOCOL_CHRONOSYNC) {
NDN_LOG_DEBUG("Using ChronoSync");
m_chronoSyncLogic = std::make_shared<chronosync::Logic>(face,
Expand All @@ -52,40 +55,45 @@ SyncProtocolAdapter::SyncProtocolAdapter(ndn::Face& face,
chronosync::Logic::DEFAULT_SYNC_REPLY_FRESHNESS,
chronosync::Logic::DEFAULT_RECOVERY_INTEREST_LIFETIME,
FIXED_SESSION);
return;
}
else {
NDN_LOG_DEBUG("Using PSync");
m_psyncLogic = std::make_shared<psync::FullProducer>(80,
face,
syncPrefix,
userPrefix,
std::bind(&SyncProtocolAdapter::onPSyncUpdate, this, _1),
syncInterestLifetime);
}
#endif

NDN_LOG_DEBUG("Using PSync");
m_psyncLogic = std::make_shared<psync::FullProducer>(80,
face,
syncPrefix,
userPrefix,
std::bind(&SyncProtocolAdapter::onPSyncUpdate, this, _1),
syncInterestLifetime);
}

void
SyncProtocolAdapter::addUserNode(const ndn::Name& userPrefix)
{
#ifdef HAVE_CHRONOSYNC
if (m_syncProtocol == SYNC_PROTOCOL_CHRONOSYNC) {
m_chronoSyncLogic->addUserNode(userPrefix, chronosync::Logic::DEFAULT_NAME, FIXED_SESSION);
return;
}
else {
m_psyncLogic->addUserNode(userPrefix);
}
#endif

m_psyncLogic->addUserNode(userPrefix);
}

void
SyncProtocolAdapter::publishUpdate(const ndn::Name& userPrefix, uint64_t seq)
{
#ifdef HAVE_CHRONOSYNC
if (m_syncProtocol == SYNC_PROTOCOL_CHRONOSYNC) {
m_chronoSyncLogic->updateSeqNo(seq, userPrefix);
return;
}
else {
m_psyncLogic->publishName(userPrefix, seq);
}
#endif
m_psyncLogic->publishName(userPrefix, seq);
}

#ifdef HAVE_CHRONOSYNC
void
SyncProtocolAdapter::onChronoSyncUpdate(const std::vector<chronosync::MissingDataInfo>& updates)
{
Expand All @@ -96,6 +104,7 @@ SyncProtocolAdapter::onChronoSyncUpdate(const std::vector<chronosync::MissingDat
m_syncUpdateCallback(update.session.getPrefix(-1), update.high);
}
}
#endif

void
SyncProtocolAdapter::onPSyncUpdate(const std::vector<psync::MissingDataInfo>& updates)
Expand Down

0 comments on commit 30d96e4

Please sign in to comment.