Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp840406rwb; Thu, 18 Aug 2022 13:15:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR5r2zuhl7RCJ5G/Eftk6IoJzUcUfl9Ue9K0XET9Xq8XL3SDiX9IdI/zGaolqeTEonEbtfqc X-Received: by 2002:a17:906:8a42:b0:730:92dc:a831 with SMTP id gx2-20020a1709068a4200b0073092dca831mr2820587ejc.481.1660853758336; Thu, 18 Aug 2022 13:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660853758; cv=none; d=google.com; s=arc-20160816; b=Tf/Kr+dCxI+k7SXm53l0/gOneys4+JEesLyiR+y7RFqSxxyIpx7AbeJVjAFidfKUfL WAHwzB3OQ2tUlKNwxOciCJ0T+4wZeyBlPdkYiAoTkJTaTgSgjI0JQ2nntJAGSA1DMuMl DTqHIdbsUbC5JjvDtC1U6yuU9vK56boedBrdI9U/yWXEeEpEqbl3SLfZoeXDq2yfTaJZ 4OhBAHsxxAthkSbeyRck95aGXqOBaFXHYHP+iQTSuTESYdPfKWqNsdUpOr9vA18mFyeZ A1QVoa/aV3CPmIbP3lXKTNjAtgyVI++9q7wdGD2CksIH8elHbm0MdDqkK3BtyeRLY2mm ZFjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=m1qLH1khdhLgXXJ8Oum2nCd1dLUuylNG5JT3wUqtFRI=; b=HzquAhIX2zSny0EOONoF5gi8JsILuFOitUa38/+BYEm02X0FzO8oewWCb/bTx+9a91 J+if2wRtNA5rT7cOuDFEgEZq+j5jZLrAxCTcZM4Xiyjs+qhlHzLDauNn2y6QqB6pLRLN uxroBgqQoPFgg0wZNAGXvnS9ipEmxhDFLr9YIBl5S8CcgiPdoCqyI12J/l5J0U9X0A2X wRTlwPvnew9uFipSbXfvzRxJbEgCLxeYhALq94M2uPXSnkdl2woIfL4S21U/QU44Qo9q pePuMMwgog8jQvmwIizwoinV+dipm9XfukpQ8tpzTTwoWLUkJJM+GUB+MJV6X82KWEPf DfUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QrnBzcj5; 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 i16-20020a1709061cd000b007357974fe2bsi1318830ejh.433.2022.08.18.13.15.31; Thu, 18 Aug 2022 13:15:58 -0700 (PDT) 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=QrnBzcj5; 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 S1344508AbiHRTwQ (ORCPT + 99 others); Thu, 18 Aug 2022 15:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244114AbiHRTwN (ORCPT ); Thu, 18 Aug 2022 15:52:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0A4ABD082; Thu, 18 Aug 2022 12:52:12 -0700 (PDT) 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 3B30F61350; Thu, 18 Aug 2022 19:52:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69D5DC433D6; Thu, 18 Aug 2022 19:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660852331; bh=m1qLH1khdhLgXXJ8Oum2nCd1dLUuylNG5JT3wUqtFRI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QrnBzcj5gpY87uXumC4RCuNvtSb4lwZjE4IxY3z5QesW18+AHDhuPEPWaQoX4ZqNe WKx/54z+tLAbUFWZDlnwuOxfEBXkMVO2wZ/b60fPo3s7cvpc/i2H/e2vdVS2s3Oi3Z tBiIsYJ4Cx7RLyKYJFDkCGkJ0rGMWzOXz7jOW6C7pNooe2Owq0cyrLrlvQoIYbjgFd Wi6F8U0gUhn8r6O+QdnFH45spaLBT6Pc1+dYs3Rhg4/tSjOw1L8/Iz8UTVKxkypDWa loUSuYf2ZwgX8rDG6UzLGO2+FccZSOXGJgVMGEDPgwscqrJ8O7JcFOea1Bke1eqOOb oLApkUI2c4lQA== Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 8966155FAC7; Thu, 18 Aug 2022 21:52:08 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Daniel Xu , bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, memxor@gmail.com Cc: pablo@netfilter.org, fw@strlen.de, netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next v2 3/4] bpf: Add support for writing to nf_conn:mark In-Reply-To: References: X-Clacks-Overhead: GNU Terry Pratchett Date: Thu, 18 Aug 2022 21:52:08 +0200 Message-ID: <87pmgxuy6v.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Daniel Xu writes: > Support direct writes to nf_conn:mark from TC and XDP prog types. This > is useful when applications want to store per-connection metadata. This > is also particularly useful for applications that run both bpf and > iptables/nftables because the latter can trivially access this > metadata. Looking closer at the nf_conn definition, the mark field (and possibly secmark) seems to be the only field that is likely to be feasible to support direct writes to, as everything else either requires special handling (like status and timeout), or they are composite field that will require helpers anyway to use correctly. Which means we're in the process of creating an API where users have to call helpers to fill in all fields *except* this one field that happens to be directly writable. That seems like a really confusing and inconsistent API, so IMO it strengthens the case for just making a helper for this field as well, even though it adds a bit of overhead (and then solving the overhead issue in a more generic way such as by supporting clever inlining). -Toke