Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp210190iob; Mon, 2 May 2022 17:18:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/6uQuvUoMQiG45P9y0tY/UizCiJM0vLzcBI0pNGLNf3nMrWTec8S4IWSor4WCkOZuvt6K X-Received: by 2002:a63:2a53:0:b0:3c1:5f80:a14c with SMTP id q80-20020a632a53000000b003c15f80a14cmr11964563pgq.279.1651537089772; Mon, 02 May 2022 17:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651537089; cv=none; d=google.com; s=arc-20160816; b=EklfBljW1svXxe78Kf7z8hRc4EKwFEh07c73UTY+CVJMF+QE1tw/XiH7+O+Wz9lUVy 8ghvk2alak2ADrFkjPro8ZyCHuYkwPwTB2tPUgFTix6SBEG/MfdUX2oM0QVYg2T72hvL lVnkygZ7c8BUbYMqWRh/HT6Plg7n70SaW5TYz9y3VSOg0FfbFQKXQ14VakVwntJRVQvK pGZOt3BlxwCcBjYw8RfZVNVJcQ9Hdf+S9cEDsrLQfvtB2aKXDv0UNMY40E0xaRtAoKif 3ufElKr4QGmB38H0nfp4H6cK/V2S7CP4Rxne3TqSGWp7i9iJO6vdkDkdYMGw+4F1nsUV MoEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GAXmCRc3lSOVYcNpy8O/6UhikW8W0LY8j/c9X7o57N8=; b=l+PUgkm8T5JCwZ7l1utJc93r2KRjQ36GXQSuohUUsbQYpMvG/1PMM+kUBg2DFY4nih RFWSz2B+3LbCmlAMhgBawcpSoc/JDZKKH3m7iMreH1jnMA5hZzS70gSW1jBuTdtvGLEz WrAYhverbjiDbEVQfx1cmr13QQtteaYKtS3KiPA9O7xhtqyjROxWr3QMT9zUZJg30uFg cW6t0A2wwuqnNYtTAkzNv3iPNWPr5GeyBhBiZUMUJi2QLO8m2RHg4ImEfdOVjo/OfHbZ njZLnx7yj9wc3jHr+jx+b+K2mjz7KI5zJbX+1zTaN5c+ylg1Qp6SYibAfClU1m8Honnz nccw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RwIlF7Tt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x63-20020a638642000000b003ab6168869esi15076400pgd.696.2022.05.02.17.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:18:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RwIlF7Tt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 739822E69C; Mon, 2 May 2022 17:15:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239246AbiD2WJA (ORCPT + 99 others); Fri, 29 Apr 2022 18:09:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358343AbiD2WI4 (ORCPT ); Fri, 29 Apr 2022 18:08:56 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF35B82D1E for ; Fri, 29 Apr 2022 15:05:35 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id w187so16791270ybe.2 for ; Fri, 29 Apr 2022 15:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GAXmCRc3lSOVYcNpy8O/6UhikW8W0LY8j/c9X7o57N8=; b=RwIlF7TtzMr9ei1gzjHEl+WsjKakPNiUJPxtsgL+xc/vfErFq25Bw2KBkF47qccKq1 lTGAgrmK2WASE4V8K9ZeW/mmDa90vzKIVXGTrrGjOiis10w/zGKjH3NSMttZkGR0DsEY CiKQHhKqMX4fa+FHrgvbC+YJrAjiULjAlydSoQnaRqvq/2dKRcMyRygxrJ1OyjYmYCHF A7ZclJQtIUf/xjn3Gkfhm/bO6HtHRCRfLc4IfG3yNwQiz4606aJ37B+r2E9kOKin+s0u vtBW+RTfulW6LmArTh5URV7MeTjhjT4XpfAugIZwf0c6S1xO7ZrgqUuI2+DH1Z5Pijb1 guIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GAXmCRc3lSOVYcNpy8O/6UhikW8W0LY8j/c9X7o57N8=; b=j/pW6yPW35yUO9ZIcjSa5DHDdVWqKVaQO3wrRTrRzgONeGph5LPd0nyEZuivu5y1+5 +DoO0apEPgF30YKIshkGGFnIxYm+ysjxpeaWqPL9MsV/MSnshbojWKBtC9zj0IdwZWN6 R/dljkFwPjxzeHN4K78D3dRd5D9n6je6P+JFBtne63OEHOc5slBC84MAnn+vNJEu2BKe hLrN7CRGnGbdPsoclqvWAvVt1XjFGTqLLKRk6c7hGzt/vRF3o+PVmx1MyJzncch17eVT SkBTlIsB/eNAe9B4pdsbj3ArLEp3WLywNSgIgmhw6hO3tr6npRLs6GoYvjw7XXK+7LXh 6l9g== X-Gm-Message-State: AOAM530nbD8DdD/K5vlyYFptmEskNg2G2TzCo91pjMiXfX8UYon8Jihp wDNFs0wnl/xg0wpfjwaBAp7O2IJ3CV1RcdUJRWBLyg== X-Received: by 2002:a25:ea48:0:b0:644:e2e5:309 with SMTP id o8-20020a25ea48000000b00644e2e50309mr1559161ybe.407.1651269934754; Fri, 29 Apr 2022 15:05:34 -0700 (PDT) MIME-Version: 1.0 References: <20151116203709.GA27178@oracle.com> <1447712932.22599.77.camel@edumazet-glaptop2.roam.corp.google.com> <04f72c85-557f-d67c-c751-85be65cb015a@gmail.com> In-Reply-To: From: Eric Dumazet Date: Fri, 29 Apr 2022 15:05:23 -0700 Message-ID: Subject: Re: Routing loops & TTL tracking with tunnel devices To: "Jason A. Donenfeld" Cc: Eric Dumazet , Netdev , LKML , Jakub Kicinski , Hannes Frederic Sowa Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Fri, Apr 29, 2022 at 2:54 PM Jason A. Donenfeld wrote: > > Hi Eric, > > On Fri, Apr 29, 2022 at 11:14 PM Eric Dumazet wrote: > > > > > > On 4/29/22 14:07, Jason A. Donenfeld wrote: > > > > Hi Eric, > > > > On Fri, Apr 29, 2022 at 01:54:27PM -0700, Eric Dumazet wrote: > > > > Anyway, it'd be nice if there were a free u8 somewhere in sk_buff that I > > could use for tracking times through the stack. Other kernels have this > > but afaict Linux still does not. I looked into trying to overload some > > existing fields -- tstamp/skb_mstamp_ns or queue_mapping -- which I was > > thinking might be totally unused on TX? > > > > if skbs are stored in some internal wireguard queue, can not you use > > skb->cb[], > > > > like many other layers do ? > > > > This isn't for some internal wireguard queue. The packets get sent out > > of udp_tunnel_xmit_skb(), so they leave wireguard's queues. > > > > > > OK, where is the queue then ? > > > > dev_xmit_recursion() is supposed to catch long chains of virtual devices. > > This is the long-chain-of-virtual-devices case indeed. But > dev_xmit_recursion() does not help here, since that's just a per-cpu > increment, assuming that the packet actually gets xmit'd in its > ndo_start_xmit function. But in reality, wireguard queues up the > packet, encrypts it in some worker later, and eventually transmits it > with udp_tunnel_xmit_skb(). All the while ndo_start_xmit() has long > returned. So no help from dev_xmit_recursion(). > I assume you add encap headers to the skb ? You could check if the wireguard header is there already, or if the amount of headers is crazy. net/core/flow_dissector.c might help. You also can take a look at CONFIG_SKB_EXTENSIONS infrastructure.