tree-wide: use af_to_ipv4_ipv6() + af_from_ipv4_ipv6() helpers at various places
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user