net: NetworkMonitor: ignore tentative IPv6 addresses

Refs: #5155
Change-Id: I29aeaa13d2aa8bbc0a687dfe3bf07772496dd472
diff --git a/ndn-cxx/net/impl/network-monitor-impl-netlink.cpp b/ndn-cxx/net/impl/network-monitor-impl-netlink.cpp
index 4fcdabd..1137992 100644
--- a/ndn-cxx/net/impl/network-monitor-impl-netlink.cpp
+++ b/ndn-cxx/net/impl/network-monitor-impl-netlink.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -363,6 +363,12 @@
     flags = *extFlags;
 #endif // NDN_CXX_HAVE_IFA_FLAGS
 
+  if (flags & IFA_F_TENTATIVE) {
+    // https://redmine.named-data.net/issues/5155#note-10
+    NDN_LOG_DEBUG("  ignoring tentative address " << ipAddr);
+    return;
+  }
+
   NetworkAddress address(ifaFamilyToAddressFamily(ifa->ifa_family),
                          ipAddr,
                          broadcastAddr,
diff --git a/ndn-cxx/net/network-address.cpp b/ndn-cxx/net/network-address.cpp
index 6f9d743..a15c939 100644
--- a/ndn-cxx/net/network-address.cpp
+++ b/ndn-cxx/net/network-address.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2021 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -43,8 +43,8 @@
 }
 
 NetworkAddress::NetworkAddress(AddressFamily family,
-                               boost::asio::ip::address ip,
-                               boost::asio::ip::address broadcast,
+                               const boost::asio::ip::address& ip,
+                               const boost::asio::ip::address& broadcast,
                                uint8_t prefixLength,
                                AddressScope scope,
                                uint32_t flags)
diff --git a/ndn-cxx/net/network-address.hpp b/ndn-cxx/net/network-address.hpp
index 6aca525..4d46374 100644
--- a/ndn-cxx/net/network-address.hpp
+++ b/ndn-cxx/net/network-address.hpp
@@ -54,8 +54,8 @@
 {
 public:
   NetworkAddress(AddressFamily family,
-                 boost::asio::ip::address ip,
-                 boost::asio::ip::address broadcast,
+                 const boost::asio::ip::address& ip,
+                 const boost::asio::ip::address& broadcast,
                  uint8_t prefixLength,
                  AddressScope scope,
                  uint32_t flags);