From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 726CEEBD for ; Sun, 23 Jul 2023 07:38:19 +0000 (UTC) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70E511BD8 for ; Sun, 23 Jul 2023 00:38:17 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 2C3B73200488; Sun, 23 Jul 2023 03:38:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 23 Jul 2023 03:38:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1690097895; x=1690184295; bh=xW0pmkNY0zExI JV6PID0EkDW2L21Z+0Rf9bCLmOJwsQ=; b=Cdyy6iydfUGwq8nXSFOmccw1Da1Rw jn2UYZsHcv5Za2aEUgWZ0xNj0gjcOlonsRfIsZigkXAFQK6QOnv4zeWUryPrXbPU OocSMinVnOrElilyPzoeNthbtAtqIdM6vN+rt9ssgE7QOK93EdSyxr9VcvgY1L9X +8F4MGn74gXtEDX19doYMSYcKirNB/Tbc9OZJGaFDD+jH+tFnYpDrn9dXemIqOl7 6GjuK93L0bBVrOOO3NHCPb66bP0RUGdQt/1CPQBV7ooxvPM7FkOMGZo6eBFmdwFl FivmMI2GB8tiGOeuvLN1F112R70Hc6EONOIXaCslLsjBqUi13EIgo6U/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrheehgdduvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepkfguohcu ufgthhhimhhmvghluceoihguohhstghhsehiughoshgthhdrohhrgheqnecuggftrfgrth htvghrnhepvddufeevkeehueegfedtvdevfefgudeifeduieefgfelkeehgeelgeejjeeg gefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih guohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Feedback-ID: i494840e7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 Jul 2023 03:38:14 -0400 (EDT) Date: Sun, 23 Jul 2023 10:38:11 +0300 From: Ido Schimmel To: Hangbin Liu Cc: David Ahern , Stephen Hemminger , netdev@vger.kernel.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Thomas Haller Subject: Re: [PATCH net-next] ipv4/fib: send RTM_DELROUTE notify when flush fib Message-ID: References: <20230718080044.2738833-1-liuhangbin@gmail.com> <20230718085814.4301b9dd@hermes.local> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On Fri, Jul 21, 2023 at 01:46:13PM +0800, Hangbin Liu wrote: > On Thu, Jul 20, 2023 at 10:01:06PM -0600, David Ahern wrote: > > >>> How about ignore route deletion for link down? e.g. > > >>> > > >>> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c > > >>> index 74d403dbd2b4..11c0f325e887 100644 > > >>> --- a/net/ipv4/fib_trie.c > > >>> +++ b/net/ipv4/fib_trie.c > > >>> @@ -2026,6 +2026,7 @@ void fib_table_flush_external(struct fib_table *tb) > > >>> int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all) > > >>> { > > >>> struct trie *t = (struct trie *)tb->tb_data; > > >>> + struct nl_info info = { .nl_net = net }; > > >>> struct key_vector *pn = t->kv; > > >>> unsigned long cindex = 1; > > >>> struct hlist_node *tmp; > > >>> @@ -2088,6 +2089,11 @@ int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all) > > >>> > > >>> fib_notify_alias_delete(net, n->key, &n->leaf, fa, > > >>> NULL); > > >>> + if (!(fi->fib_flags & RTNH_F_LINKDOWN)) { > > >>> + rtmsg_fib(RTM_DELROUTE, htonl(n->key), fa, > > >>> + KEYLENGTH - fa->fa_slen, tb->tb_id, &info, 0); > > >>> + } > > >> > > >> Will you get a notification in this case for 198.51.100.0/24? > > > > > > No. Do you think it is expected with this patch or not? > > > > The intent is that notifications are sent for link events but not route > > events which are easily deduced from the link events. > > Sorry, I didn't get what you mean. The link events should be notified to user > via rtmsg_ifinfo_event()? So I think here we ignore the route events caused by > link down looks reasonable. The route in the scenario I mentioned wasn't deleted because of a link event, but because the source address was deleted yet no notification was emitted. IMO, this is wrong given the description of the patch. I assume NetworkManager already knows how to delete routes given RTM_DELLINK events. Can't it be taught to react to RTM_DELADDR events as well? Then this functionality will always work, regardless of the kernel version being used.