When link_get_by_index() succeeds, the result is always non-NULL.
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;
}
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)
}
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);
}
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;
}
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)