network: accept all values provided by kernel
Follow-up for af493fb742.
The kernel sends FRA_SUPPRESS_IFGROUP attribute with -1, that must be
handled by networkd.
For FRA_SUPPRESS_PREFIXLEN, we already handled -1, but ignored values
larger than 128. We should not configure rules with such a meaningless
value, but should manage such rules when received from kernel. It can
occur when created by other tools mistakenly. If networkd ignores them,
then networkd cannot remove them.
This commit is contained in:
committed by
Luca Boccassi
parent
b049b48c4b
commit
b2174e2922
@@ -1061,14 +1061,8 @@ int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, Man
|
||||
log_warning_errno(r, "rtnl: could not get FRA_SUPPRESS_PREFIXLEN attribute, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
if (r >= 0) {
|
||||
/* kernel does not limit this value, but we do. */
|
||||
if (suppress_prefixlen > 128) {
|
||||
log_warning("rtnl: received invalid FRA_SUPPRESS_PREFIXLEN attribute value %"PRIu32", ignoring.", suppress_prefixlen);
|
||||
return 0;
|
||||
}
|
||||
if (r >= 0)
|
||||
tmp->suppress_prefixlen = (int32_t) suppress_prefixlen;
|
||||
}
|
||||
|
||||
uint32_t suppress_ifgroup;
|
||||
r = sd_netlink_message_read_u32(message, FRA_SUPPRESS_IFGROUP, &suppress_ifgroup);
|
||||
@@ -1076,13 +1070,8 @@ int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, Man
|
||||
log_warning_errno(r, "rtnl: could not get FRA_SUPPRESS_IFGROUP attribute, ignoring: %m");
|
||||
return 0;
|
||||
}
|
||||
if (r >= 0) {
|
||||
if (suppress_ifgroup > INT32_MAX) {
|
||||
log_warning("rtnl: received invalid FRA_SUPPRESS_IFGROUP attribute value %"PRIu32", ignoring.", suppress_ifgroup);
|
||||
return 0;
|
||||
}
|
||||
if (r >= 0)
|
||||
tmp->suppress_ifgroup = (int32_t) suppress_ifgroup;
|
||||
}
|
||||
|
||||
if (adjust_protocol)
|
||||
/* As .network files does not have setting to specify protocol, we can assume the
|
||||
|
||||
Reference in New Issue
Block a user