From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A3DDC433E0 for ; Mon, 18 May 2020 14:32:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29CC620671 for ; Mon, 18 May 2020 14:32:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gybNCSr8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727975AbgEROcj (ORCPT ); Mon, 18 May 2020 10:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726940AbgEROcj (ORCPT ); Mon, 18 May 2020 10:32:39 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2636C061A0C; Mon, 18 May 2020 07:32:37 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id 18so1081738iln.9; Mon, 18 May 2020 07:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gTFX1DQNwBeEvhDCNe+w/mdg1eQLrgIFr7Wfxdb54bo=; b=gybNCSr8wur5riIJiDtO9j7Zaq5DCHwnjR7x7kpUwmWCv3nRjCQ2ztoLUMoKWaFdl9 dbxsZ56cl+vgTpoXhifhjlu6ef+U0U3fR8/LHo/6Kcv4aEKq9cKi6hcDr3bE0XvP1Y/u tAti+H04McSI+3r6FgcEq5Qe2/7q/zgTs3/Mp0aCkT43lFfITPgo30ps3huDbSIqIXEe F0sxPAfkTI8hJgtHcA+jBVbaYzVvPCTUa1/au3PdYCUL+rVp0km/nMTa7mSa7BvsIchZ jvQMGCGLHvS1g59DxMr8WV1uYMN3GW2l8reIZjajxIuL+9UI0HJYwEswGdU7oB0gM2l4 rGpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gTFX1DQNwBeEvhDCNe+w/mdg1eQLrgIFr7Wfxdb54bo=; b=qe1Rm6h9JhRVjTi/qVwoBex8YD69ZFOewoWvvmTINOIjWDhr8Epb1C4MLwNlO/cvq3 HjXB35ja91Tbiw2QX4JaT9prdtdrjP6PR4qNNcQ6w1yqY1uIAuwwlyawqzEpU2P6FSWQ +3YEeeX/TwytrLix8kzN3IamLG8rdMRKBpy/rLsxYBfY/9bbgOLpeZHodlwEG7AesDaa HVS1/9HKknR6DSDCjWvTDgglYcZxgxu5Q6t8BX+ZtEx9YZ9+WpSHtD+ZfN7vxyz8A3UT KGdKJ8AJMt+MfjbIP0fyE5oynpZ5Pv7Fi3xWhhSFVrAUK++gOx44vxrDX7fLSo7gJ4kl 32rg== X-Gm-Message-State: AOAM533aEyF9tI3n0d3TTld6MrFNE+3LzD0fAjF2gh5W44YW8zmlCUYF DmhBNP4+kTOcMDGZWinxxgI= X-Google-Smtp-Source: ABdhPJzP+N6VAlMslLBJq9/URUv1mJX/In/Rz7/h1fi5yhqxLZBwn8EhFBm7pL5xHxo0RFFw2Y70gw== X-Received: by 2002:a92:8946:: with SMTP id n67mr14129948ild.215.1589812357310; Mon, 18 May 2020 07:32:37 -0700 (PDT) Received: from ?IPv6:2601:282:803:7700:f866:b23:9405:7c31? ([2601:282:803:7700:f866:b23:9405:7c31]) by smtp.googlemail.com with ESMTPSA id j2sm3962464ioo.8.2020.05.18.07.32.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2020 07:32:36 -0700 (PDT) Subject: Re: "Forwarding" from TC classifier To: Lorenz Bauer Cc: bpf , Networking , Martynas Pumputis , kernel-team References: <5cca7bce-0052-d854-5ead-b09d43cb9eb9@gmail.com> From: David Ahern Message-ID: Date: Mon, 18 May 2020 08:32:35 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 5/18/20 3:38 AM, Lorenz Bauer wrote: > On Fri, 15 May 2020 at 15:24, David Ahern wrote: >> >> On 5/15/20 3:59 AM, Lorenz Bauer wrote: >>> >>> Yes, but that doesn't play well with changing the source address to >>> the local machine's, since the upper part of the stack will drop the >>> packet due to accept_local=0. >> >> Can you defer the source address swap to the Tx path? Let the packet go >> up the stack and do the fib lookup again as an skb. neighbor entry does >> not exist, so the packet is stashed, neighbor resolution done, once >> resolved the packet goes out. tc program on the egress device can flip >> the source address, and then subsequent packets take the XDP fast path. > > Hm, that's an interesting idea! I guess this means I have to mark the packet > somehow, to make sure I can identify it on the TX path. Plus, in theory > the packet could exit via any interface, so I'd have to attach classifiers to > a bunch of places if I want to be on the safe side. Shared blocks might save you some overhead. Create a filter block that is shared across devices. > > Upside: this seems doable in current kernels. Downside: seems more fragile > than I'd like. > > Thanks for the thought, I'll play around with it :) > >> >> If the next host is on the same LAN I believe the stack will want to >> generate an ICMP redirect, but that can be squashed. >