From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jason A. Donenfeld" Subject: [PATCH v2] fib_rules: match rules based on suppress_* properties too Date: Tue, 26 Jun 2018 01:39:32 +0200 Message-ID: <20180625233932.11531-1-Jason@zx2c4.com> References: Cc: "Jason A. Donenfeld" To: roopa@cumulusnetworks.com, netdev@vger.kernel.org Return-path: Received: from frisell.zx2c4.com ([192.95.5.64]:46713 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752363AbeFYXkA (ORCPT ); Mon, 25 Jun 2018 19:40:00 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Two rules with different values of suppress_prefix or suppress_ifgroup are not the same. This fixes an -EEXIST when running: $ ip -4 rule add table main suppress_prefixlength 0 Signed-off-by: Jason A. Donenfeld Fixes: f9d4b0c1e969 ("fib_rules: move common handling of newrule delrule msgs into fib_nl2rule") --- This adds the new condition you mentioned. I'm not sure what you make of DaveM's remark about this not being in the original code, but here is nonetheless the requested change. net/core/fib_rules.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 126ffc5bc630..bc8425d81022 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -416,6 +416,14 @@ static struct fib_rule *rule_find(struct fib_rules_ops *ops, if (rule->mark && r->mark != rule->mark) continue; + if (rule->suppress_ifgroup != -1 && + r->suppress_ifgroup != rule->suppress_ifgroup) + continue; + + if (rule->suppress_prefixlen != -1 && + r->suppress_prefixlen != rule->suppress_prefixlen) + continue; + if (rule->mark_mask && r->mark_mask != rule->mark_mask) continue; -- 2.17.1