face, mgmt: improve face creation failure and bad URI handling

Prevent creation of faces to endpoints owned by NFD instance

Prevent creation of UDP broadcast faces (255.255.255.255 and
those belonging to machine's interfaces) in response to
face creation command

Sanity check configuration file port numbers in face manager

refs: #1414, #1427

Change-Id: Ia3f0a9337f3d97c34388773eab05bc39ad6dd804
This commit is contained in:
Steve DiBenedetto authored and Alex Afanasyev committed 2014-04-06 10:54:20 -07:00
1 parent b07788af05
commit ca53ac6b00
11 files changed
+342 -43

No files matched your search

+11
View File
@@ -95,6 +95,17 @@ listNetworkInterfaces()
break;
#endif
}
if (netif->isBroadcastCapable() && ifa->ifa_broadaddr != 0)
{
const sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(ifa->ifa_broadaddr);
char address[INET_ADDRSTRLEN];
if (::inet_ntop(AF_INET, &sin->sin_addr, address, sizeof(address)))
netif->broadcastAddress = boost::asio::ip::address_v4::from_string(address);
else
NFD_LOG_WARN("inet_ntop() failed on " << ifname);
}
}
::freeifaddrs(ifa_list);