From patchwork Sat Jun 23 15:59:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 139759 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2127997lji; Sat, 23 Jun 2018 08:59:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJvfghxhd513Aj2Ht3Zi8OvioY1rWFzGPhvYV/L90Rz7n/LXDhUbOrBdO/Ig1FAfBgSBNeu X-Received: by 2002:a17:902:16a4:: with SMTP id h33-v6mr3553270plh.25.1529769582854; Sat, 23 Jun 2018 08:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529769582; cv=none; d=google.com; s=arc-20160816; b=RUQT2EAwis81C4QFoLwPmSK+Sl/6FMCt6J53S3K7NASN4iJvsQqwQs4ESFPxoLaLuA OOO48mMWiWa44arZJ5bN5YnNlddJF0bG3wDW8rEaNpJsR/yh5dsGteynqETcN4U7GBsI 74K728F4cXfk4u9L7Z0FP1jHj6bi86fa4SgBv3NnvWNrMcXUMNKKKmUgvVvaJ0w2tl/h Y1iFaBwWrjt5lCSoaUUYencUiOIlqTDUXFFNi2t9WXF9qrlZUEkuBXQTOcq4LoaPhuJ5 egSg7Jj+vJ1393ZluWIKmDwUUuAVv4tdzOE/OQj9tvl3mlIb+pHZPb/+3rikJaEW5c4R aTiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=p/hLNkOIi+go3/KGD8B0klY+LkMGr1DDcSB23QRNaL8=; b=S1qZAlgFfkZuvSz5nI6X9mCvO08r/EktpQAx78XSAnnC1ACgHpwdJomf1oQHSu4Doi QghGE1o9teeZ/vQLaPh1Zy7ATE1QL+uusT/W69mEIRE7Deo7U9e5DHoWGNgEF0GkUfgC LZRrBoONAMAJ2FBs3ASi9jhL58bfmWYdG2jACsQx7b/rXnHca2x+R7f1HidJcajxEXrg plkTs9vaSy6xRNMaxjGU+0HSZR6sZnBGzd0tTVuJ6JgLIhvqcGIOhhpoUVJYah2H1ZtZ 0iL/2Yb6jsFy+06OXK7AyPSgAuUc6UplmgQsunTbbKocNqAzTvUDDIdM2LomGd++Gu7o TCvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b="vo3/WMx0"; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18-v6si9849669plo.285.2018.06.23.08.59.42; Sat, 23 Jun 2018 08:59:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b="vo3/WMx0"; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751647AbeFWP7i (ORCPT + 9 others); Sat, 23 Jun 2018 11:59:38 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:59347 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeFWP7h (ORCPT ); Sat, 23 Jun 2018 11:59:37 -0400 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id f9afbac3; Sat, 23 Jun 2018 15:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=mail; bh=MluC yB3SkMF57KDvSuddpsd7xBo=; b=vo3/WMx0MdFtOdSAtEpO99kJjmpJJ03ahqsG oK6sQXNp24q+3MJ3YzR7iLi8bFVKC+ghZQ4b3xh4DWQOtZopvW74odmAJ9Tej1+D GhlAlUUz4Esmq2Pi121szskCq44C8iMKnrVf6nTlNcOb417JkZE9522RSiTHfvLv lOHaidXt79we/D2rlKL2IvAHFObmCrlKAxyZhapGJSoE2nPeRv/lSixmcmCWXBwj 66VuHJ8QTl7GbwOkmQg2U4g1BY89vA7kVWdpQC48KzUpACfLAryRSCpmd/v/zQPR G70vGl0iLdhAhuLSWg+oxkjFAAL+gv8g8Q4mcv0GW1y1tVXFQA== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id cf28534b (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sat, 23 Jun 2018 15:53:13 +0000 (UTC) From: "Jason A. Donenfeld" To: roopa@cumulusnetworks.com, Netdev Cc: "Jason A. Donenfeld" Subject: [PATCH] fib_rules: match rules based on suppress_* properties too Date: Sat, 23 Jun 2018 17:59:30 +0200 Message-Id: <20180623155930.25983-1-Jason@zx2c4.com> In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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") --- net/core/fib_rules.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 126ffc5bc630..665799311b98 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -416,6 +416,12 @@ static struct fib_rule *rule_find(struct fib_rules_ops *ops, if (rule->mark && r->mark != rule->mark) continue; + if (r->suppress_ifgroup != rule->suppress_ifgroup) + continue; + + if (r->suppress_prefixlen != rule->suppress_prefixlen) + continue; + if (rule->mark_mask && r->mark_mask != rule->mark_mask) continue;