diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-09-22 22:40:55 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-10-11 20:26:06 +0200 |
commit | 70465e5b6168755b2f6407e94b27c6564c3fe63f (patch) | |
tree | 01c0508479db19d7a0900d29d1873722d67f6415 /src/network/networkd-route-nexthop.c | |
parent | network/route-metric: merge conf parsers for route metric (diff) | |
download | systemd-70465e5b6168755b2f6407e94b27c6564c3fe63f.tar.xz systemd-70465e5b6168755b2f6407e94b27c6564c3fe63f.zip |
network/route-nexthop: use log_syntax_parse_error()
Diffstat (limited to '')
-rw-r--r-- | src/network/networkd-route-nexthop.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/network/networkd-route-nexthop.c b/src/network/networkd-route-nexthop.c index ee837d73fa..c0c77c02f5 100644 --- a/src/network/networkd-route-nexthop.c +++ b/src/network/networkd-route-nexthop.c @@ -1006,11 +1006,8 @@ int config_parse_gateway( } r = in_addr_from_string_auto(rvalue, &route->nexthop.family, &route->nexthop.gw); - if (r < 0) { - log_syntax(unit, LOG_WARNING, filename, line, r, - "Invalid %s='%s', ignoring assignment: %m", lvalue, rvalue); - return 0; - } + if (r < 0) + return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); route->gateway_from_dhcp_or_ra = false; TAKE_PTR(route); @@ -1096,10 +1093,8 @@ int config_parse_route_nexthop( } r = safe_atou32(rvalue, &id); - if (r < 0) { - log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse nexthop ID, ignoring assignment: %s", rvalue); - return 0; - } + if (r < 0) + return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); if (id == 0) { log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid nexthop ID, ignoring assignment: %s", rvalue); return 0; @@ -1157,13 +1152,8 @@ int config_parse_multipath_route( p = rvalue; r = extract_first_word(&p, &word, NULL, 0); - if (r == -ENOMEM) - return log_oom(); - if (r <= 0) { - log_syntax(unit, LOG_WARNING, filename, line, r, - "Invalid multipath route option, ignoring assignment: %s", rvalue); - return 0; - } + if (r <= 0) + return log_syntax_parse_error(unit, filename, line, r, lvalue, rvalue); dev = strchr(word, '@'); if (dev) { |