Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4227703rwj; Tue, 20 Dec 2022 07:36:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf72RgQGHPOUd1IyXp5cLdpVqBiCPl2HEGZPQyc5n2dPtFB/uYMTSkUqF2q4eb08LV7n5P/3 X-Received: by 2002:a17:907:20ce:b0:7c1:6344:845 with SMTP id qq14-20020a17090720ce00b007c163440845mr31996868ejb.34.1671550574509; Tue, 20 Dec 2022 07:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671550574; cv=none; d=google.com; s=arc-20160816; b=ONL6zMM+Zm3ZSKNqzYMQEEPCqFp24mPAXrh5THqh4HpyKcMTuwVGoyutZZF+9wJ9fI XFBW8YTmvG96OcmdqA5dB2kZNDQHbmks1qgCcvHRFNW2mPyYx/5gsH7oqjfKp27W6I9m E7s6Fwh7gWcMQ3BfYyN70wT/Q9TP3VVxl/hUDbrSa4/R4Irdq4yaFuzhLG6wV8VC6lUE GcfF3KSo1COGIf+g/ZbnSpFlo+b6hV9bJMgb6GrCBbOFAxek2C17n5yuZSgDzk+5juX8 87I5G/+k8EFXr0sTHVoGqM3Lw1H3BztUzPYgs6WQAlrNBHAxM/lYziJ3qa29EjfoFnlv Ae3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=WNgy0xZEzhZBzeIUuv4SJ2ffNKBvorwQf7UWBgp/Ytc=; b=Q3Rax7C4baZuOrz4J3iyTTNUV+GKEOAsw70627qLXmcs62w7vxfOyu8QktlpBJ1d3u sLj7mFKMbzB5wVlWC/V2bJGpND94j4YOC3p93ewlQTUq6SEa8wKnWSu2vsaSIRTYybi1 BWG8PA10iAQphzkSHmkTriT7LjRfMcON53eTGr4Y+/56VWm3Dp5QpGot9svTQ+zRAEZZ dfaLSXV68lOKWiSpSzj+NC2K+VPlVKmnbfiRwrpXSwx/iCFxgGc/rNrOKX7u0KUzx/y2 TCINpQstVCpuCiyZltHWjKg4N8DRavwDdp1DxkSk2jwq4E7NKTHTr4H1DBaBMDxr/dMb K/XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MPH4tkYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rl11-20020a170907216b00b0078e28a52d58si9621217ejb.874.2022.12.20.07.35.57; Tue, 20 Dec 2022 07:36:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MPH4tkYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233010AbiLTPKh (ORCPT + 69 others); Tue, 20 Dec 2022 10:10:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbiLTPKf (ORCPT ); Tue, 20 Dec 2022 10:10:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DD88301; Tue, 20 Dec 2022 07:10:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DFF1A614AE; Tue, 20 Dec 2022 15:10:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2ED6C433D2; Tue, 20 Dec 2022 15:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671549033; bh=MnSUn++QuKMw7l2ujm9/FRvrB65xWP0qsHEyLbhYtWU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=MPH4tkYl4WoZvpgX6HOcoeqj7Vuil+JozuFFEEUko0cOsINtzcrOt1wmTR1p6ZOcQ wwpknn1G15WEFA2wu99Zj7Bib4E3D5pztbar0m+HixMN19Rg95UKyGEZQnwxJY+un4 URTuAzkwj6+FJ8ccSi2A0j5sGVOqAFM6szdKM4fjNcgMwzNK6SvqReZRQ5IEeLqOjg sXUODwX67a4B1FiPA0k/juUlJ+zm+tSiBz7PBwsY7tEeaZEBstbn62XxaNqUD4TGtZ juCybEBSEeYbl9ejnrRHwesbE4SzNwSNx/p3z5LBhjb9/TJx/WdGbLzw8GTW6ZihXi 1BQ/pxOUtfYzw== Message-ID: Date: Tue, 20 Dec 2022 08:10:32 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [net-next] ipv6: fix routing cache overflow for raw sockets Content-Language: en-US To: Paolo Abeni , Jon Maxwell , davem@davemloft.net Cc: edumazet@google.com, kuba@kernel.org, yoshfuji@linux-ipv6.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221218234801.579114-1-jmaxwell37@gmail.com> <9f145202ca6a59b48d4430ed26a7ab0fe4c5dfaf.camel@redhat.com> From: David Ahern In-Reply-To: <9f145202ca6a59b48d4430ed26a7ab0fe4c5dfaf.camel@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/20/22 5:35 AM, Paolo Abeni wrote: > On Mon, 2022-12-19 at 10:48 +1100, Jon Maxwell wrote: >> Sending Ipv6 packets in a loop via a raw socket triggers an issue where a >> route is cloned by ip6_rt_cache_alloc() for each packet sent. This quickly >> consumes the Ipv6 max_size threshold which defaults to 4096 resulting in >> these warnings: >> >> [1] 99.187805] dst_alloc: 7728 callbacks suppressed >> [2] Route cache is full: consider increasing sysctl net.ipv6.route.max_size. >> . >> . >> [300] Route cache is full: consider increasing sysctl net.ipv6.route.max_size. > > If I read correctly, the maximum number of dst that the raw socket can > use this way is limited by the number of packets it allows via the > sndbuf limit, right? > > Are other FLOWI_FLAG_KNOWN_NH users affected, too? e.g. nf_dup_ipv6, > ipvs, seg6? > > @DavidA: why do we need to create RTF_CACHE clones for KNOWN_NH flows? > > Thanks, > > Paolo > If I recall the details correctly: that sysctl limit was added back when ipv6 routes were managed as dst_entries and there was a desire to allow an admin to limit the memory consumed. At this point in time, IPv6 is more inline with IPv4 - a separate struct for fib entries from dst entries. That "Route cache is full" message is now out of date since this is dst_entries which have a gc mechanism. IPv4 does not limit the number of dst_entries that can be allocated (ip_rt_max_size is the sysctl variable behind the ipv4 version of max_size and it is a no-op). IPv6 can probably do the same here? I do not believe the suggested flag is the right change.