summaryrefslogtreecommitdiff
path: root/src/network/networkd-address.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-10-27 17:39:18 +0100
committerTom Gundersen <teg@jklm.no>2014-10-27 17:40:24 +0100
commita2a85a22b3c82386633ab898012c4b249706d535 (patch)
tree3c74c7d924b57f1be863c5dccdb9fd45d4666f5f /src/network/networkd-address.c
parentdf40eee8edccb6bf09a57c2b96f69d233032ce52 (diff)
networkd: network - if no prefixlength is given, try to deduce one from the address class
In case of a class E or F address, ignore the address.
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r--src/network/networkd-address.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index e595cd6e94..ce85109d22 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -482,7 +482,7 @@ int config_parse_address(const char *unit,
r = safe_atou(e + 1, &i);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
- "Interface prefix length is invalid, ignoring assignment: %s", e + 1);
+ "Prefix length is invalid, ignoring assignment: %s", e + 1);
return 0;
}
@@ -499,6 +499,15 @@ int config_parse_address(const char *unit,
return 0;
}
+ if (!e && f == AF_INET) {
+ r = in_addr_default_prefixlen(&buffer.in, &n->prefixlen);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Prefix length not specified, and a default one can not be deduced for '%s', ignoring assignment", address);
+ return 0;
+ }
+ }
+
if (n->family != AF_UNSPEC && f != n->family) {
log_syntax(unit, LOG_ERR, filename, line, EINVAL,
"Address is incompatible, ignoring assignment: %s", address);