mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
network: check prefixlen when null address is specified to Address=
This commit is contained in:
parent
f2efbeafb8
commit
c9207ff3a4
@ -761,6 +761,19 @@ int config_parse_address(const char *unit,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (in_addr_is_null(f, &buffer)) {
|
||||
/* Will use address from address pool. Note that for ipv6 case, prefix of the address
|
||||
* pool is 8, but 40 bit is used by the global ID and 16 bit by the subnet ID. So,
|
||||
* let's limit the prefix length to 64 or larger. See RFC4193. */
|
||||
if ((f == AF_INET && prefixlen < 8) ||
|
||||
(f == AF_INET6 && prefixlen < 64)) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, 0,
|
||||
"Null address with invalid prefixlen='%u', ignoring assignment: %s",
|
||||
prefixlen, rvalue);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
n->family = f;
|
||||
n->prefixlen = prefixlen;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user