diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-17 18:50:50 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-02-17 19:48:07 +0100 |
commit | bb3b08ad983a15fe948e20443376ddbf0cab6ce7 (patch) | |
tree | 47311832eb6174fce622191db0a389ec61d03e5f /src/resolve/resolved-manager.c | |
parent | tree-wide: use in_addr_is_set() or friends (diff) | |
download | systemd-bb3b08ad983a15fe948e20443376ddbf0cab6ce7.tar.xz systemd-bb3b08ad983a15fe948e20443376ddbf0cab6ce7.zip |
resolve: make manager_find_ifindex() or friends return earlier
Diffstat (limited to '')
-rw-r--r-- | src/resolve/resolved-manager.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c index a2a2cf4954..6cc3a5d56f 100644 --- a/src/resolve/resolved-manager.c +++ b/src/resolve/resolved-manager.c @@ -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; |