mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 16:21:26 +03:00
resolve: make manager_find_ifindex() or friends return earlier
This commit is contained in:
parent
94876904bb
commit
bb3b08ad98
@ -697,6 +697,12 @@ LinkAddress *link_find_address(Link *l, int family, const union in_addr_union *i
|
||||
|
||||
assert(l);
|
||||
|
||||
if (!IN_SET(family, AF_INET, AF_INET6))
|
||||
return NULL;
|
||||
|
||||
if (!in_addr)
|
||||
return NULL;
|
||||
|
||||
LIST_FOREACH(addresses, a, l->addresses)
|
||||
if (a->family == family && in_addr_equal(family, &a->in_addr, in_addr))
|
||||
return a;
|
||||
|
@ -1153,6 +1153,12 @@ int manager_find_ifindex(Manager *m, int family, const union in_addr_union *in_a
|
||||
|
||||
assert(m);
|
||||
|
||||
if (!IN_SET(family, AF_INET, AF_INET6))
|
||||
return 0;
|
||||
|
||||
if (!in_addr)
|
||||
return 0;
|
||||
|
||||
a = manager_find_link_address(m, family, in_addr);
|
||||
if (a)
|
||||
return a->link->ifindex;
|
||||
@ -1248,6 +1254,12 @@ LinkAddress* manager_find_link_address(Manager *m, int family, const union in_ad
|
||||
|
||||
assert(m);
|
||||
|
||||
if (!IN_SET(family, AF_INET, AF_INET6))
|
||||
return NULL;
|
||||
|
||||
if (!in_addr)
|
||||
return NULL;
|
||||
|
||||
HASHMAP_FOREACH(l, m->links) {
|
||||
LinkAddress *a;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user