diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-11-16 22:50:35 +0900 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2021-11-16 23:31:24 +0000 |
commit | b2174e2922aaeff32c1d842cc9285508d3fe370e (patch) | |
tree | 361d896417334131c712d4a8234b22a71c44d000 | |
parent | b049b48c4b6e60c3cbec9d2884f90fd4e7013219 (diff) | |
download | systemd-b2174e2922aaeff32c1d842cc9285508d3fe370e.tar.gz |
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.
-rw-r--r-- | src/network/networkd-routing-policy-rule.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index 1d0dff56ce..72ef39f457 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 |