From patchwork Mon Jun 25 23:39:32 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: 139892 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4560950lji; Mon, 25 Jun 2018 16:40:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIhYhhVy9Wmvam7sxKuuc0+q/+7ME4ZtwF6Ntmum0Qs8997SkfZd4jZGkoRxt+eu5E6QqP/ X-Received: by 2002:a63:686:: with SMTP id 128-v6mr9028458pgg.338.1529970004051; Mon, 25 Jun 2018 16:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529970004; cv=none; d=google.com; s=arc-20160816; b=TwGYLcfaCw6ZqFfiIrBTuZluhvjoH1EYD6RAnKFj1i0Dmqu7DBzMtjEGCM5Lona54o hCQ8QXsdlJWwxNlTyQeC2ptbn+LIboWkkbjLkimlKxMfRwf8xNakdvVNtvZ0CJ19r4Ri A02ts7wgSPneZw01Cb+dl3jLMSLAlCFrezx3PyH70EQmMumjgJM24BLxICDbGQmhSW0n aoVRU2gRKgJQrH/7bAfZMbKPHQbesyyCbSQZoErNz1vzf2CJG4sOGeqK0AhekR5fdCjs BDW96INmZtZ1uegpk6/S415en3XekjBVDjljbVI2R2cNYx3Lrn2ci88p4HkLEZ4NU5PY PPAw== 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=Iii14qtlx2SG4Vj7jeGNk0QzM+6W5LMLtgqqLIaBg/I=; b=gx9u3tftbW3tCie8Bv6wT9KkCfmbIrQCDEXek6iouCrPg8MknqDcHJYe8v6/+QRbf5 eZKGMBlfMm6KQgcT+tBKdsuLnZLR6sEMg1zqGOZzJl/fODAnkrnTrt3AaQpLNg8ihtUx oxjGpyXv8e0TNzx2GWDpwtF2Mw/RnGV50P3IWh/k/wd4pC/x6WhZugdvLAu2FofxBVXY wNL4BBmGn2Q/S3B5a2qjMNJkhwe3cSjFnjUzVi81m4pKI19eLWCucl6kQnDcsobk3BtV 7BeuNI1VcnKILB7IYh/q57SnnmHjiqFmXuLQYVh1g+gSeus4uj7UYmbcUJrMRAN/APH6 J/4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=VOoYrzFt; 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 v8-v6si169458pfn.191.2018.06.25.16.40.03; Mon, 25 Jun 2018 16:40:04 -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=VOoYrzFt; 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 S932379AbeFYXkB (ORCPT + 9 others); Mon, 25 Jun 2018 19:40:01 -0400 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 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 8f0741bc; Mon, 25 Jun 2018 23:33:18 +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=w2tq o2ThSgmkTXPJkfHy12bxeX0=; b=VOoYrzFtyNKJvjGUlDctvXBoFKadrdpcTBM1 Fme4daUYwEJ/FtugXoXRaCI1cO+Zg/+UbXMIzMpMl8rQfIVs+1SFQg/Dql11AHd0 TaLmmjCdi74ZL9FJFlGu0y8SskEC02TSUngCaz0BUlMNcqP/0XhI5zkMdpgUGtrD UgdxIww7aEWNV81NQcgKwo8e4BXpYoi74nMZYhXv1FuglaNVO0oep61sz41TNOsi yAM13ZG61IwlWzG0iao6cdGxqKi+mGUQnjdFhA1zC/LFmMhzXZcZlhdm8Z0A/7zE +L7/acijvWiJcsHqk5yIo+BILzXWqLYNkBWfDifJ13m9cOhAJg== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 758814c8 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Mon, 25 Jun 2018 23:33:18 +0000 (UTC) From: "Jason A. Donenfeld" To: roopa@cumulusnetworks.com, netdev@vger.kernel.org Cc: "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> 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") --- 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(+) -- 2.17.1 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;