summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-11-16 16:53:26 +0100
committerGitHub <noreply@github.com>2021-11-16 16:53:26 +0100
commit91822de4f6866bee4eae6393c76746bc25e8f33e (patch)
tree8363ba655a8fe86ca5297d023a56bcdd5de4f704 /src
parentMerge pull request #21380 from poettering/homed-test-qemu (diff)
parentnetwork: address: explicitly mention that the address is localhost (diff)
downloadsystemd-91822de4f6866bee4eae6393c76746bc25e8f33e.tar.xz
systemd-91822de4f6866bee4eae6393c76746bc25e8f33e.zip
Merge pull request #21383 from yuwata/network-address-scope
network: use route_scope_from_string() at one more place
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-address.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 5ef38bc476..a78ad6d93b 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -14,6 +14,7 @@
#include "networkd-manager.h"
#include "networkd-network.h"
#include "networkd-queue.h"
+#include "networkd-route-util.h"
#include "networkd-route.h"
#include "parse-util.h"
#include "string-util.h"
@@ -1770,21 +1771,14 @@ int config_parse_address_scope(
return 0;
}
- if (streq(rvalue, "host"))
- n->scope = RT_SCOPE_HOST;
- else if (streq(rvalue, "link"))
- n->scope = RT_SCOPE_LINK;
- else if (streq(rvalue, "global"))
- n->scope = RT_SCOPE_UNIVERSE;
- else {
- r = safe_atou8(rvalue , &n->scope);
- if (r < 0) {
- log_syntax(unit, LOG_WARNING, filename, line, r,
- "Could not parse address scope \"%s\", ignoring assignment: %m", rvalue);
- return 0;
- }
+ r = route_scope_from_string(rvalue);
+ if (r < 0) {
+ log_syntax(unit, LOG_WARNING, filename, line, r,
+ "Could not parse address scope \"%s\", ignoring assignment: %m", rvalue);
+ return 0;
}
+ n->scope = r;
n->scope_set = true;
TAKE_PTR(n);
return 0;
@@ -1924,8 +1918,8 @@ static int address_section_verify(Address *address) {
if (address->scope_set && address->scope != RT_SCOPE_HOST)
log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
- "%s: non-host scope is set in the [Address] section from line %u. "
- "Ignoring Scope= setting.",
+ "%s: non-host scope is set for localhost address. "
+ "Ignoring Scope= setting in the [Address] section from line %u. ",
address->section->filename, address->section->line);
address->scope = RT_SCOPE_HOST;