Received: by 10.223.176.5 with SMTP id f5csp692944wra; Fri, 9 Feb 2018 05:48:31 -0800 (PST) X-Google-Smtp-Source: AH8x224UfpOwAl2Fxm2+w+ahB5CRlgEkHu6aNZ9hqH1+sXYf1Caty1mL/RBeAYB1WGX7K98hSgX8 X-Received: by 2002:a17:902:bc3:: with SMTP id 61-v6mr2580714plr.407.1518184111310; Fri, 09 Feb 2018 05:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518184111; cv=none; d=google.com; s=arc-20160816; b=ypmFT1brjSbAlf1hOM+ZMm+AcvL2atCssJvNsU8jV8nlrPg+fP5Bt1FYwsv/cbPhHW p2xAADg0cXm+eDZ7ZXqJF8PTCYGcioHFt3PJYHqdhduyDN4SRYKsEo8IXif0DrD4WkBh L0wF+g/2eA5duqfTqwYnNKZZTiKAB9a/t9BjZkHCz1zybLjJdHyI3Q+Gc0yO8OBX/7Z3 ofJw4pVdAe1yyfkcqvdMVEO8xb/UchSj9adZrSQ4Zn5g2zxuRm+Ld6jGdfzAZpZBe9rG 7fzMspx0QfLrWtCG+GWbduE8BaKKy7+ZloYT0TDSuMaqLIM0cclbD2wdlaam8J5QQIq7 MMtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4wRl9CqA03B3h8g6lpEI9CZWf2qK0LwWm0REpoCdB4c=; b=qN73O1/ahRuFNEEeFQwMTaq8dJBL5JmQAErd+X7LRngTB5TZtx7dV9wuvTKmasY49O rjFC3/N6dwxFYBKPayBeModC8ir29ScMDKNYc7XZ64G3eqWLYCJh58oJlrpbGWF4xQms G1MtHyw/huQp6Zz55yZcuAIy0YW3nEugzNEbMWXn3o/GLB9A3jnRrZNdO5PN318BeSWP /cTDhODZs4wT/vuw+MebhQilny8FlPL1zd6GRh4IuWVzCA1IrJg42Aw6EdU5gQW6YT1Z hD4Yjg6ZYYM3CUQQW1OdTgs7fF31xnqA/UhCwxYpMWI/qiSZjn7BpJobtrKTb0xVAuKx piCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t64si1368567pgc.749.2018.02.09.05.48.17; Fri, 09 Feb 2018 05:48:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932237AbeBINrP (ORCPT + 99 others); Fri, 9 Feb 2018 08:47:15 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53632 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932225AbeBINrM (ORCPT ); Fri, 9 Feb 2018 08:47:12 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 27335E93; Fri, 9 Feb 2018 13:47:12 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Wang , Eric Dumazet , Martin KaFai Lau , Paolo Abeni , "David S. Miller" Subject: [PATCH 4.15 09/23] ipv6: change route cache aging logic Date: Fri, 9 Feb 2018 14:40:07 +0100 Message-Id: <20180209133938.854044659@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133938.366024920@linuxfoundation.org> References: <20180209133938.366024920@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wei Wang [ Upstream commit 31afeb425f7fad8bcf9561aeb0b8405479f97a98 ] In current route cache aging logic, if a route has both RTF_EXPIRE and RTF_GATEWAY set, the route will only be removed if the neighbor cache has no NTF_ROUTER flag. Otherwise, even if the route has expired, it won't get deleted. Fix this logic to always check if the route has expired first and then do the gateway neighbor cache check if previous check decide to not remove the exception entry. Fixes: 1859bac04fb6 ("ipv6: remove from fib tree aged out RTF_CACHE dst") Signed-off-by: Wei Wang Signed-off-by: Eric Dumazet Acked-by: Martin KaFai Lau Acked-by: Paolo Abeni Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/route.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1586,12 +1586,19 @@ static void rt6_age_examine_exception(st * EXPIRES exceptions - e.g. pmtu-generated ones are pruned when * expired, independently from their aging, as per RFC 8201 section 4 */ - if (!(rt->rt6i_flags & RTF_EXPIRES) && - time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) { - RT6_TRACE("aging clone %p\n", rt); + if (!(rt->rt6i_flags & RTF_EXPIRES)) { + if (time_after_eq(now, rt->dst.lastuse + gc_args->timeout)) { + RT6_TRACE("aging clone %p\n", rt); + rt6_remove_exception(bucket, rt6_ex); + return; + } + } else if (time_after(jiffies, rt->dst.expires)) { + RT6_TRACE("purging expired route %p\n", rt); rt6_remove_exception(bucket, rt6_ex); return; - } else if (rt->rt6i_flags & RTF_GATEWAY) { + } + + if (rt->rt6i_flags & RTF_GATEWAY) { struct neighbour *neigh; __u8 neigh_flags = 0; @@ -1606,11 +1613,8 @@ static void rt6_age_examine_exception(st rt6_remove_exception(bucket, rt6_ex); return; } - } else if (__rt6_check_expired(rt)) { - RT6_TRACE("purging expired route %p\n", rt); - rt6_remove_exception(bucket, rt6_ex); - return; } + gc_args->more++; }