network/netdev: also check ifindex, iftype, and kind when assigning NetDev to Link

Even when a NetDev object with the same name found, its iftype or kind
may be different. For safety, let's also check them.
This commit is contained in:
Yu Watanabe
2024-09-10 16:38:06 +09:00
parent f2129f1d8c
commit 1788c34628
3 changed files with 40 additions and 8 deletions
+1
View File
@@ -207,6 +207,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
bool netdev_is_managed(NetDev *netdev);
int netdev_get(Manager *manager, const char *name, NetDev **ret);
void link_assign_netdev(Link *link);
int netdev_set_ifindex(NetDev *netdev, sd_netlink_message *newlink);
int netdev_generate_hw_addr(NetDev *netdev, Link *link, const char *name,
const struct hw_addr_data *hw_addr, struct hw_addr_data *ret);