Replace originIsManuallyAssigned with inline test
The originIsManuallyAssigned function does not need to be present.
When automatic link local addresses are active, the conditional
compilation made sure to only test for addresses of 'static' origin.
When manual link local addresses are active, by definition the address
assignment is done using a IPSRC == static action. It is not possible
to use IPMI or Redfish to assert a "link local" flag. Thus all link
local addresses are merely statically assigned addresses. The
systemd-network stack asserts the link local scope based on the IP
address assigned.
Tested:
Enabled LINK_LOCAL_AUTOCONFIGURATION and used DHCP and static address
assignments.
When DHCPv4 is turned off, a link local address is assigned to the link.
With DHCPv4 turned on, the link local address is disabled.
Explicitly adding a static address inside the 169.254 address space
causes systemd to report the address scope to be link local.
Restoring DHCPv4 disables all link local addresses per IETF RFCs.
Manually disabled LINK_LOCAL_AUTOCONFIGURATION, as phosphor-network
does provide dynamic control.
Disabled DHCPv4 and confirmed there are no link local or DHCPv4
addresses.
Assigned a 169.254.x.x address w/o DHCPv4 or LinkLocalAddressing.
Confirmed a "scope link" address was reported via 'ip addr'.
Change-Id: I4d7e55dc3014b5b0acdd12bd8ac85ea650c13b9c
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index c1433a7..10229ac 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -158,19 +158,6 @@
}
}
-bool EthernetInterface::originIsManuallyAssigned(IP::AddressOrigin origin)
-{
- return (
-#ifdef LINK_LOCAL_AUTOCONFIGURATION
- (origin == IP::AddressOrigin::Static)
-#else
- (origin == IP::AddressOrigin::Static ||
- origin == IP::AddressOrigin::LinkLocal)
-#endif
-
- );
-}
-
void EthernetInterface::addAddr(const AddressInfo& info)
{
IP::AddressOrigin origin = IP::AddressOrigin::Static;
@@ -741,7 +728,7 @@
auto& address = network["Address"];
for (const auto& addr : addrs)
{
- if (originIsManuallyAssigned(addr.second->origin()))
+ if (addr.second->origin() == IP::AddressOrigin::Static)
{
address.emplace_back(stdplus::toStr(addr.first));
}
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
index aae2e1f..c7af241 100644
--- a/src/ethernet_interface.hpp
+++ b/src/ethernet_interface.hpp
@@ -258,12 +258,6 @@
stdplus::PinnedRef<Manager> manager,
const AllIntfInfo& info, std::string&& objPath,
const config::Parser& config, bool enabled);
-
- /** @brief Determines if the address is manually assigned
- * @param[in] origin - The origin entry of the IP::Address
- * @returns true/false value if the address is static
- */
- bool originIsManuallyAssigned(IP::AddressOrigin origin);
};
} // namespace network