net: parse interface names more loosely in FaceUri

Only ':', '/', and whitespace are illegal.

Change-Id: I2c017682d299a12885c96c9b212c503319ca4f08
Refs: #4474
diff --git a/src/net/face-uri.cpp b/src/net/face-uri.cpp
index 3e9f358..97fe0f7 100644
--- a/src/net/face-uri.cpp
+++ b/src/net/face-uri.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2013-2017 Regents of the University of California,
+ * Copyright (c) 2013-2018 Regents of the University of California,
  *                         Arizona Board of Regents,
  *                         Colorado State University,
  *                         University Pierre & Marie Curie, Sorbonne University,
@@ -79,8 +79,7 @@
   m_path = protocolMatch[4];
 
   // pattern for IPv6 link local address enclosed in [ ], with optional port number
-  static const boost::regex v6LinkLocalExp("^\\[([a-fA-F0-9:]+)%([a-zA-Z0-9]+)\\]"
-                                           "(?:\\:(\\d+))?$");
+  static const boost::regex v6LinkLocalExp("^\\[([a-fA-F0-9:]+)%([^\\s/:]+)\\](?:\\:(\\d+))?$");
   // pattern for IPv6 address enclosed in [ ], with optional port number
   static const boost::regex v6Exp("^\\[([a-fA-F0-9:]+)\\](?:\\:(\\d+))?$");
   // pattern for Ethernet address in standard hex-digits-and-colons notation
@@ -441,11 +440,6 @@
     : IpHostCanonizeProvider("udp")
   {
   }
-
-protected:
-  // checkAddress is not overriden:
-  // Although NFD doesn't support IPv6 multicast, it's an implementation limitation.
-  // FaceMgmt protocol allows IPv6 multicast address in UDP.
 };
 
 class TcpCanonizeProvider : public IpHostCanonizeProvider<boost::asio::ip::tcp>
diff --git a/tests/unit-tests/net/face-uri.t.cpp b/tests/unit-tests/net/face-uri.t.cpp
index 1f90f67..73549df 100644
--- a/tests/unit-tests/net/face-uri.t.cpp
+++ b/tests/unit-tests/net/face-uri.t.cpp
@@ -173,6 +173,17 @@
 
   BOOST_CHECK(uri.parse("udp6://[fe80::1%1]:6363"));
   BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]"));
+
+  BOOST_CHECK(uri.parse("udp6://[ff01::114%eth#1]"));
+  BOOST_CHECK(uri.parse("udp6://[ff01::114%eth.1,2]"));
+  BOOST_CHECK(uri.parse("udp6://[ff01::114%a+b-c=0]"));
+  BOOST_CHECK(uri.parse("udp6://[ff01::114%[foo]]"));
+  BOOST_CHECK(uri.parse("udp6://[ff01::114%]]"));
+  BOOST_CHECK(uri.parse("udp6://[ff01::114%%]"));
+  BOOST_CHECK(!uri.parse("udp6://[ff01::114%]"));
+  BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo bar]"));
+  BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo/bar]"));
+  BOOST_CHECK(!uri.parse("udp6://[ff01::114%eth0:1]"));
 }
 
 BOOST_FIXTURE_TEST_CASE(IsCanonicalUdp, CanonizeFixture)