ethernet_interface: Fix updates without interface idx
This fixes VLAN creation
Change-Id: I1d2fa8f9d20edfc49077f77d38e3ddcfbf49a6de
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
index f480b2f..2e42e7f 100644
--- a/src/ethernet_interface.cpp
+++ b/src/ethernet_interface.cpp
@@ -85,8 +85,7 @@
const config::Parser& config,
bool enabled) :
Ifaces(bus, objPath.c_str(), Ifaces::action::defer_emit),
- manager(manager), bus(bus), objPath(std::move(objPath)),
- ifIdx(info.intf.idx)
+ manager(manager), bus(bus), objPath(std::move(objPath))
{
interfaceName(*info.intf.name, true);
auto dhcpVal = getDHCPValue(config);
@@ -130,6 +129,7 @@
void EthernetInterface::updateInfo(const InterfaceInfo& info, bool skipSignal)
{
+ ifIdx = info.idx;
EthernetInterfaceIntf::linkUp(info.flags & IFF_RUNNING, skipSignal);
if (info.mac)
{
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index 014d0b4..2d0f506 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -133,6 +133,15 @@
return;
}
}
+ else if (info.intf.name)
+ {
+ auto it = interfaces.find(*info.intf.name);
+ if (it != interfaces.end())
+ {
+ it->second->updateInfo(info.intf);
+ return;
+ }
+ }
if (!info.intf.name)
{
auto msg = fmt::format("Can't create interface without name: {}",