1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-09 13:57:42 +03:00

network: drop unnecessary conditions

When link_get_by_index() succeeds, the result is always non-NULL.
This commit is contained in:
Yu Watanabe 2023-07-10 09:38:38 +09:00
parent 5fb1f929d5
commit a3a25d01ce
4 changed files with 5 additions and 5 deletions

View File

@ -1403,7 +1403,7 @@ void address_cancel_request(Address *address) {
int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message, Manager *m) {
_cleanup_(address_freep) Address *tmp = NULL;
struct ifa_cacheinfo cinfo;
Link *link = NULL;
Link *link;
uint16_t type;
Address *address = NULL;
int ifindex, r;
@ -1439,7 +1439,7 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
}
r = link_get_by_index(m, ifindex, &link);
if (r < 0 || !link) {
if (r < 0) {
/* when enumerating we might be out of sync, but we will get the address again, so just
* ignore it */
if (!m->enumerating)

View File

@ -490,7 +490,7 @@ int manager_rtnl_process_neighbor(sd_netlink *rtnl, sd_netlink_message *message,
}
r = link_get_by_index(m, ifindex, &link);
if (r < 0 || !link) {
if (r < 0) {
/* when enumerating we might be out of sync, but we will get the neighbor again. Also,
* kernel sends messages about neighbors after a link is removed. So, just ignore it. */
log_debug("rtnl: received neighbor for link '%d' we don't know about, ignoring.", ifindex);

View File

@ -835,7 +835,7 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message,
}
r = link_get_by_index(m, ifindex, &link);
if (r < 0 || !link) {
if (r < 0) {
if (!m->enumerating)
log_warning("rtnl: received nexthop message for link (%"PRIu32") we do not know about, ignoring", ifindex);
return 0;

View File

@ -1719,7 +1719,7 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, Ma
}
r = link_get_by_index(m, ifindex, &link);
if (r < 0 || !link) {
if (r < 0) {
/* when enumerating we might be out of sync, but we will
* get the route again, so just ignore it */
if (!m->enumerating)