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=-3.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham 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 705A0C10F13 for ; Tue, 16 Apr 2019 15:00:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45C0820652 for ; Tue, 16 Apr 2019 15:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729869AbfDPPAG (ORCPT ); Tue, 16 Apr 2019 11:00:06 -0400 Received: from Chamillionaire.breakpoint.cc ([146.0.238.67]:57766 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729757AbfDPPAF (ORCPT ); Tue, 16 Apr 2019 11:00:05 -0400 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.89) (envelope-from ) id 1hGPZ4-0003RI-G0; Tue, 16 Apr 2019 17:00:02 +0200 Date: Tue, 16 Apr 2019 17:00:02 +0200 From: Florian Westphal To: Lorenz Bauer Cc: herbert@gondor.apana.org.au, netdev@vger.kernel.org Subject: Re: Question re. skb_orphan for TPROXY Message-ID: <20190416150002.cbkih4lfrna4ywdu@breakpoint.cc> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Lorenz Bauer wrote: > Apologies for contacting you out of the blue. I'm currently trying to > understand how TPROXY works under the hood. As part of this endeavour, > I've stumbled upon the commit attached to this email. > > From the commit message I infer that somewhere, TPROXY relies on a > check of skb->sk == NULL to function. However, I can't figure out > where! I've traced TPROXY from NF_HOOK(NF_INET_PRE_ROUTING) just after > the call to skb_orphan to __inet_lookup_skb / skb_steal_sock called > from the TCP and UDP receive functions, and as far as I can tell there > is no such check. Can you maybe shed some light on this? Without the skb_orphan udp/tcp might steal tunnel/ppp etc. socket instead of tproxy assigned tcp/udp socket.