mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
Merge pull request #16271 from yuwata/network-cleanups-around-link-get
network: several tiny cleanups around link_get()
This commit is contained in:
@@ -364,7 +364,7 @@ static int netdev_enslave(NetDev *netdev, Link *link, link_netlink_message_handl
|
||||
if (r >= 0)
|
||||
callback(netdev->manager->rtnl, m, link);
|
||||
} else {
|
||||
/* the netdev is not yet read, save this request for when it is */
|
||||
/* the netdev is not yet ready, save this request for when it is */
|
||||
netdev_join_callback *cb;
|
||||
|
||||
cb = new(netdev_join_callback, 1);
|
||||
|
||||
@@ -346,6 +346,9 @@ static void link_update_master_operstate(Link *link, NetDev *netdev) {
|
||||
if (!netdev)
|
||||
return;
|
||||
|
||||
if (netdev->ifindex <= 0)
|
||||
return;
|
||||
|
||||
if (link_get(link->manager, netdev->ifindex, &master) < 0)
|
||||
return;
|
||||
|
||||
@@ -752,7 +755,7 @@ int link_get(Manager *m, int ifindex, Link **ret) {
|
||||
Link *link;
|
||||
|
||||
assert(m);
|
||||
assert(ifindex);
|
||||
assert(ifindex > 0);
|
||||
assert(ret);
|
||||
|
||||
link = hashmap_get(m->links, INT_TO_PTR(ifindex));
|
||||
|
||||
@@ -1272,6 +1272,9 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message,
|
||||
if (r < 0 && r != -ENODATA) {
|
||||
log_warning_errno(r, "rtnl: could not get NHA_OIF attribute, ignoring: %m");
|
||||
return 0;
|
||||
} else if (tmp->oif <= 0) {
|
||||
log_warning("rtnl: received nexthop message with invalid ifindex %d, ignoring.", tmp->oif);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = link_get(m, tmp->oif, &link);
|
||||
|
||||
Reference in New Issue
Block a user