summaryrefslogtreecommitdiff
path: root/src/shared/bus-unit-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-05-10 17:24:48 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-11 15:42:11 +0200
commita481753648da77758b13b82e8d82be8e332f515e (patch)
tree154c9200f061299970cd7839beb52afa097bdba7 /src/shared/bus-unit-util.c
parent23118193d23438f9fdb4dd31c9acc5d6bfcc393c (diff)
downloadsystemd-a481753648da77758b13b82e8d82be8e332f515e.tar.gz
tree-wide: use af_to_ipv4_ipv6() + af_from_ipv4_ipv6() helpers at various places
Diffstat (limited to 'src/shared/bus-unit-util.c')
-rw-r--r--src/shared/bus-unit-util.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index 4d53aaa3da..54d04aae50 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -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");
}