tree-wide: use af_to_ipv4_ipv6() + af_from_ipv4_ipv6() helpers at various places

This commit is contained in:
Lennart Poettering
2021-05-11 15:42:11 +02:00
parent 23118193d2
commit a481753648
6 changed files with 27 additions and 27 deletions
+3 -5
View File
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "af-list.h"
#include "alloc-util.h"
#include "bus-error.h"
#include "bus-unit-util.h"
@@ -879,11 +880,8 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons
address_family = eq ? word : NULL;
if (address_family) {
if (streq(address_family, "ipv4"))
family = AF_INET;
else if (streq(address_family, "ipv6"))
family = AF_INET6;
else
family = af_from_ipv4_ipv6(address_family);
if (family == AF_UNSPEC)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Only \"ipv4\" and \"ipv6\" protocols are supported");
}