From patchwork Thu Feb 9 09:28:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 726003 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3vJt786t99z9s7H for ; Thu, 9 Feb 2017 20:28:52 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="bfQCaUKL"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752506AbdBIJ2u (ORCPT ); Thu, 9 Feb 2017 04:28:50 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:35263 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752279AbdBIJ2s (ORCPT ); Thu, 9 Feb 2017 04:28:48 -0500 Received: by mail-wm0-f48.google.com with SMTP id v186so74450393wmd.0 for ; Thu, 09 Feb 2017 01:28:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4X6hQH/PMlQg7rIs3G4EqU87svyIhRJzBaf9uDt8xyQ=; b=bfQCaUKLPfn16xj06uD4HIxUi110cIy5LhS4fO2uJeSfZZZyrUtEmzfO0CyAdOIUse KboGcVbe7udhvOFJk+qg+Leb8d8orzORjsBL+DWzsHkgiR4VqFT0bEpiKQ+U/jc42nUt 1iEUdFnVv62cFiA6oU7fKb3+T6UTUDDpPjpem50lHidwLTFFaUR/Dgg6QkTVP9JmIspl bto2TXo6UJY6O3S8Bfrv4PgDwhGz5J076v0hobTQXJAZZzf4d+dzaNZ77FVW9mlYF4Kc 1748U62hBNOySVlrRiSo2duOh6AhXD5PV7RjvYipvfvIEHW5XNoiQA0eIZVKHXoUEJE9 PMgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4X6hQH/PMlQg7rIs3G4EqU87svyIhRJzBaf9uDt8xyQ=; b=rMJ79crlg36z4XQe8SCWvrzTru/9psrT7+iPQSealTElO8z1dFqKTsuMA2DVLAjHmr x+xPdcctH03MWyDRWd4tol1Om7ECmlUz72Jbc9bnfzGKPlNBv/e2BvyvWENQIL75kG1x Xed+qy4XF3Oz3iNcDtTAmJHiTxkj2FweyxP8jjcLiQBwLClno6K+BQ+97WlOktZQGsml S88GKd1hHC81175ohAWChS1EQXxcberyQqJrOgDugLA9FVDFtlQvbcQ2+2K8iT9hhY3x s99Z4pBLRtS+cdGKLAYGhvhwXc7K4/LBEQ+9zwpwI7K3QGjbTWGQ7vQcYHDK9xQyGb25 yoDg== X-Gm-Message-State: AMke39nb1WPF46rmtZj7RxWGgaiW46UpcbN4Q8j3jAgt7AfcQB0anHQEz7hJY773liL3Zg== X-Received: by 10.28.68.6 with SMTP id r6mr20594021wma.57.1486632526809; Thu, 09 Feb 2017 01:28:46 -0800 (PST) Received: from localhost (ip-78-45-162-92.net.upcbroadband.cz. [78.45.162.92]) by smtp.gmail.com with ESMTPSA id b8sm17499876wrb.17.2017.02.09.01.28.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 01:28:46 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com, mlxsw@mellanox.com, Alexander Duyck , Patrick McHardy Subject: [patch net-next 1/7] ipv4: fib: Only flush FIB aliases belonging to currently flushed table Date: Thu, 9 Feb 2017 10:28:38 +0100 Message-Id: <1486632524-5588-2-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486632524-5588-1-git-send-email-jiri@resnulli.us> References: <1486632524-5588-1-git-send-email-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel In case the MAIN table is flushed and its trie is shared with the LOCAL table, then we might be flushing FIB aliases belonging to the latter. This can lead to FIB_ENTRY_DEL notifications sent with the wrong table ID. The above doesn't affect current listeners, as the table ID is ignored during entry deletion, but this will change later in the patchset. When flushing a particular table, skip any aliases belonging to a different one. Signed-off-by: Ido Schimmel Signed-off-by: Jiri Pirko CC: Alexander Duyck CC: Patrick McHardy Reviewed-by: Alexander Duyck --- net/ipv4/fib_trie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 2919d1a..5ef4596 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -1963,7 +1963,8 @@ int fib_table_flush(struct net *net, struct fib_table *tb) hlist_for_each_entry_safe(fa, tmp, &n->leaf, fa_list) { struct fib_info *fi = fa->fa_info; - if (!fi || !(fi->fib_flags & RTNH_F_DEAD)) { + if (!fi || !(fi->fib_flags & RTNH_F_DEAD) || + tb->tb_id != fa->tb_id) { slen = fa->fa_slen; continue; }