mgmt: allow omitted FaceId in faces/create command
Change-Id: I27655e8b7e67dce88e787a0b4b18fe34cafbf5d5
Refs: #2031
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index bda1681..5c91547 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.cpp
@@ -143,14 +143,15 @@
if (verbProcessor != m_signedVerbDispatch.end())
{
ControlParameters parameters;
- if (!extractParameters(parameterComponent, parameters) || !parameters.hasFaceId())
+ if (!extractParameters(parameterComponent, parameters))
{
NFD_LOG_DEBUG("command result: malformed verb: " << verb);
sendResponse(command, 400, "Malformed command");
return;
}
- if (parameters.getFaceId() == 0)
+ bool isSelfRegistration = (!parameters.hasFaceId() || parameters.getFaceId() == 0);
+ if (isSelfRegistration)
{
parameters.setFaceId(request->getIncomingFaceId());
}