networkd: Permit all-zero RoutingPolicyRule prefixes

For example this `From` address range is no longer ignored:

    [RoutingPolicyRule]
    From=0.0.0.0/8
This commit is contained in:
Hristo Venev
2021-06-22 20:19:12 +09:00
committed by Yu Watanabe
parent ffd0815171
commit 2e8a32afbc
3 changed files with 17 additions and 3 deletions
+2 -2
View File
@@ -402,7 +402,7 @@ static int routing_policy_rule_set_netlink_message(const RoutingPolicyRule *rule
/* link may be NULL. */
if (in_addr_is_set(rule->family, &rule->from)) {
if (rule->from_prefixlen > 0) {
r = netlink_message_append_in_addr_union(m, FRA_SRC, rule->family, &rule->from);
if (r < 0)
return log_link_error_errno(link, r, "Could not append FRA_SRC attribute: %m");
@@ -412,7 +412,7 @@ static int routing_policy_rule_set_netlink_message(const RoutingPolicyRule *rule
return log_link_error_errno(link, r, "Could not set source prefix length: %m");
}
if (in_addr_is_set(rule->family, &rule->to)) {
if (rule->to_prefixlen > 0) {
r = netlink_message_append_in_addr_union(m, FRA_DST, rule->family, &rule->to);
if (r < 0)
return log_link_error_errno(link, r, "Could not append FRA_DST attribute: %m");