From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8558C28CC5 for ; Wed, 5 Jun 2019 03:29:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AEFA42070D for ; Wed, 5 Jun 2019 03:29:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZD5czFcK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbfFED3i (ORCPT ); Tue, 4 Jun 2019 23:29:38 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:33240 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbfFED3i (ORCPT ); Tue, 4 Jun 2019 23:29:38 -0400 Received: by mail-pf1-f193.google.com with SMTP id x15so4196128pfq.0 for ; Tue, 04 Jun 2019 20:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=4Ef0nirmEraBXGoO/xfex12g/MC3WpaxrMid1law3SI=; b=ZD5czFcKcKBnQWJbG/uXtkMM1EDw9WCmG9EevCTnOiKLjTTKCjwOb5CiGE+mvp71qU useFGWgVoe3SwyF8fyhGMe+dovFxBTRzHSRetR9tc4qfXJOZQFs7h9Kwk2+zd4PfLfcH RWD8G/kCfqkPHpas/ymLffbqP/oUvp1MITp2vYgf1qd2VMZaG+SGs4wDPM8iW1a66gL1 QmX4X7lydkfaXnqzD0Uz+6va5DUPVj0pP2Dbh4038bvjhlaXzQYbRCrON2SS4ZNDTus6 le+sd75E2TiOEBe0iZ5W0tPy0E+RC/I9JYsvPxc9UfcbMU/ka/VkBgq7j5PhzCM1Ja3y +Ctw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4Ef0nirmEraBXGoO/xfex12g/MC3WpaxrMid1law3SI=; b=gimzuDGXfbmFZmrF85Nzt5NDcaP9mN+qvwvzQdVfHRaoagSkfaAsq1u6ncemonj6fi WCHhYV3ANX+cofYqEhrBZk77kB5MK9omI7JD6Fl3O+jRtlucVYBWPnNuzVHL9jixz3YB JAcL13NNtqIWZ9b4gtWA7e8daVg5ukArnreUBlUZbQK2vOI1dcu+CJ5wW6DVYOmKYIko C52LfQ8EC6EeLsjYFACbVRu8sF/HpXps0H8UMj+ce268JSSvVl1oTA1UZJx1xBIqRZ0H ziwOvX1xABjlbXuWlyBrvekZK5clxFEjwSocj9hSfMadKdO4TnZZTSuV7BA4uKEHzHUB YoVg== X-Gm-Message-State: APjAAAUFPnMITNN6+afLN5HE/Zw2rt143bGnoz++bD1wzJbfkTAIhsVP +8wZgsmZX1yj3J6zF/kbtdU= X-Google-Smtp-Source: APXvYqzZZowMQwwaMKEojynwz5YeUxLqHWSN0760GZwAcvnGe+FV8pDiCQO1gfR70CS6drH04nerrg== X-Received: by 2002:a63:8dc4:: with SMTP id z187mr1242157pgd.337.1559705377828; Tue, 04 Jun 2019 20:29:37 -0700 (PDT) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id 12sm8841482pfi.60.2019.06.04.20.29.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jun 2019 20:29:36 -0700 (PDT) Date: Wed, 5 Jun 2019 11:29:26 +0800 From: Hangbin Liu To: Lorenzo Colitti Cc: David Ahern , David Miller , Yaro Slav , Thomas Haller , Alistair Strachan , Greg KH , Linux NetDev , David Ahern , Maciej =?utf-8?Q?=C5=BBenczykowski?= Subject: Re: [PATCH net] fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied Message-ID: <20190605032926.GA18865@dhcp-12-139.nay.redhat.com> References: <20190507091118.24324-1-liuhangbin@gmail.com> <20190508.093541.1274244477886053907.davem@davemloft.net> <20190605014344.GY18865@dhcp-12-139.nay.redhat.com> <20190605021533.GZ18865@dhcp-12-139.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jun 05, 2019 at 11:25:11AM +0900, Lorenzo Colitti wrote: > On Wed, Jun 5, 2019 at 11:15 AM Hangbin Liu wrote: > > How do you add the rules? with ip cmd it should has NLM_F_EXCL flag and > > you will get -EEXIST error out. > > The fact that the code worked before this commit implies that it was > *not* using NLM_F_EXCL. :-) Yes, that's why you got the issue. > We rely on being able to add a rule and either have a dup be created > (in which case we'll remove it later) or have it fail with EEXIST (in > which case we won't remove it later). With Maciej said, how about add NLM_F_EXCL flag when you add a new rule. If it returned EEXIST, which means there is an dup rule, you just do not remove it later. Would that fix your issue? Thanks Hangbin