From: Yu Watanabe Date: Tue, 16 Nov 2021 13:50:35 +0000 (+0900) Subject: network: accept all values provided by kernel X-Git-Tag: v250-rc1~230 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2174e2922aaeff32c1d842cc9285508d3fe370e;p=thirdparty%2Fsystemd.git network: accept all values provided by kernel Follow-up for af493fb742bece2cafcdbab9238c711ac9090c9f. 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. --- diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index 1d0dff56ce2..72ef39f4579 100644 --- a/src/network/networkd-routing-policy-rule.c +++ b/src/network/networkd-routing-policy-rule.c @@ -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