summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-nexthop.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-11-01 16:48:42 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-11-01 20:52:16 +0100
commitb71a721fbc5bd4e7d45fd39c0af79e985c9c6b22 (patch)
treeda0712dd9ce4e76457f69525cac84b3f7811fde8 /src/network/networkd-nexthop.c
parentbuild(deps): bump meson from 1.2.2 to 1.2.3 in /.github/workflows (diff)
downloadsystemd-b71a721fbc5bd4e7d45fd39c0af79e985c9c6b22.tar.xz
systemd-b71a721fbc5bd4e7d45fd39c0af79e985c9c6b22.zip
parse-util: add parse_tristate() and use it everywhere
We parse tristates all the time, let's add an explicit parser for them.
Diffstat (limited to 'src/network/networkd-nexthop.c')
-rw-r--r--src/network/networkd-nexthop.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c
index 2af65ec260..e2ded28197 100644
--- a/src/network/networkd-nexthop.c
+++ b/src/network/networkd-nexthop.c
@@ -1229,21 +1229,13 @@ int config_parse_nexthop_onlink(
if (r < 0)
return log_oom();
- if (isempty(rvalue)) {
- n->onlink = -1;
- TAKE_PTR(n);
- return 0;
- }
-
- r = parse_boolean(rvalue);
+ r = parse_tristate(rvalue, &n->onlink);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}
- n->onlink = r;
-
TAKE_PTR(n);
return 0;
}