Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1097043ybl; Thu, 23 Jan 2020 13:31:56 -0800 (PST) X-Google-Smtp-Source: APXvYqwsNaFA/kYoPfVgMG+PQyO/JX8L2IgWSttULVOD9PM14BqP7ifsrFL/II55QsrlwD5UWKH6 X-Received: by 2002:aca:110a:: with SMTP id 10mr12163925oir.130.1579815116027; Thu, 23 Jan 2020 13:31:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579815116; cv=none; d=google.com; s=arc-20160816; b=GspDxoeYN46Fn7a9tBCrL7M3YrnYuKCNHlerCTWsxJrCAzY/tNyHRlEguvHucvoRP9 W/IYaLmx3FMl7TU/c82dF7SRPCLOXvFmirWn2ddmir5cw9lwx4E/sBRpKnQDzRn4hV/R m+EW4xSwhQ/BbTM4FMjePusBBuRElBS0xwwpKGco0PuqdyQjdv/Mcl1vVo1M4UVMv+cq mfYCrxeS5TZltP/ExKl+xxdFQwaNtkfRgsJml7NUOrLklNDL4mf/LGp3pK3AdndMe1Ao omtUXdhbLFgXAEHWjgGmkzsrUQFsBnDBdkreEehAPI0iK1ziFm6F3/crtz36hcfA8wUZ Eq9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YSbU1uqjZPOEO1Y+Gw50u5Z+ggq+k7efj1RntkA3E9U=; b=Qkdsq6rwvS4L25gj/lc4CtBF5yH52U/6j+g6IgladU/+x67hLFLq05FzdADdQDlszv LXTE87IrfovtWhhceDqA7/rd0fCSlrnE8/ENv3RIAQ6Fdoe+EZDhXyqSOCOgfrqhVJ11 daBW+gTJDKZUGmTb33Oc4/E1MbuamypcUc0uaEtjvDfGwSd3k5K8W51FleP+T9VNPJtz sj23/zQEepObzdcTppP61elQFz/0c4tmm5Cp28M5O8N8iDNl0/UiIt9Q4hzeAe1nKT+8 Q1W4K0pBIjkeDNfZw2MduVc4GXnlG1y/+MzOBtFXAUNS8sN02d6ullKpJP672H5YV6PZ UuLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oPAt2jQl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t12si1742630otq.53.2020.01.23.13.31.43; Thu, 23 Jan 2020 13:31:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oPAt2jQl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728827AbgAWV25 (ORCPT + 99 others); Thu, 23 Jan 2020 16:28:57 -0500 Received: from mail-ua1-f67.google.com ([209.85.222.67]:38943 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726118AbgAWV25 (ORCPT ); Thu, 23 Jan 2020 16:28:57 -0500 Received: by mail-ua1-f67.google.com with SMTP id 73so42904uac.6; Thu, 23 Jan 2020 13:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YSbU1uqjZPOEO1Y+Gw50u5Z+ggq+k7efj1RntkA3E9U=; b=oPAt2jQlapEzqqZVJrKArIR0wSaVYzkP6sejlZbngsxvYIPYyDxnAQpP7+80ejkcjB NQQ6Vze/aeClkDRc/5difGCA92dclJVwbmwr30eJ1i/xxEe+0zUn2fOApOulJRecJRjM mZbmbA3s2XDKCHWV2qjv4J1nHMvGH0pl09dTFtBMUbJiIYs82Z1gR2r3M+xjz2kdEgNt Sak9EB6jELEBFm+Xat7qdGrhzEdnbAxpwbSwoWsVFtT3vezMRn2BNJUL4REgvCDveC8S lOrEqONEgloVs5rrpyVO8klYyypX01Q1M8MgIzqeZoUtom+Lc7waBhR8+sAQYA81zSYy ythQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YSbU1uqjZPOEO1Y+Gw50u5Z+ggq+k7efj1RntkA3E9U=; b=sijKP5MqIl7cIWeFlkKuQFGH8SzwsbHGapcRYkoX488ENQCXwaQ+s3nTpvXedJNe4+ yze2pCTw/GXeYZkR4C6QEkmEqvz+7uQufdPowepDgdtQXB2wbQ2/NAr5KfJEB4oZLFCE zNF6CsEzlWcgOpUvrYdTqEec+vkFJK/KmyIJe8d5w0zuHxmJ2SyNGzvg+uXoyLo39WRE fSoYYtnJq+4RKFBYOyoi3hBIsheaikkDy+I9b0KRRFQG01TDeVLUMl/bXCdzky2DIx/N +LM339gSd3a1BOUJ4hKeiXCowGkzZYgvp6f353DigGgvNI8wpbvecJlwohlh31LGMryy sGfw== X-Gm-Message-State: APjAAAVyUuQnw+XatPUIozefx+mZAjJT92KTLDO31CDKkbNbT65/18xG LgPWnS3jw59gYPeDP413fdWr5JrsGFPb43mO54Y= X-Received: by 2002:ab0:40a3:: with SMTP id i32mr11123232uad.131.1579814935885; Thu, 23 Jan 2020 13:28:55 -0800 (PST) MIME-Version: 1.0 References: <20200118000128.15746-1-matthew.cover@stackpath.com> <5e23c773d7a67_13602b2359ea05b824@john-XPS-13-9370.notmuch> <360a11cd-2c41-159e-b92a-c7c1ec42767f@iogearbox.net> In-Reply-To: <360a11cd-2c41-159e-b92a-c7c1ec42767f@iogearbox.net> From: Matt Cover Date: Thu, 23 Jan 2020 14:28:43 -0700 Message-ID: Subject: Re: [PATCH bpf-next] bpf: add bpf_ct_lookup_{tcp,udp}() helpers To: Daniel Borkmann Cc: John Fastabend , Alexei Starovoitov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , "David S. Miller" , Shuah Khan , Jakub Kicinski , Jesper Dangaard Brouer , Jakub Sitnicki , Quentin Monnet , Matthew Cover , Stanislav Fomichev , Andrey Ignatov , Lorenz Bauer , Jiong Wang , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 20, 2020 at 2:11 PM Daniel Borkmann wrote: > > On 1/20/20 9:10 PM, Matt Cover wrote: > > On Mon, Jan 20, 2020 at 11:11 AM Matt Cover wrote: > >> On Sat, Jan 18, 2020 at 8:05 PM John Fastabend wrote: > >>> Matthew Cover wrote: > >>>> Allow looking up an nf_conn. This allows eBPF programs to leverage > >>>> nf_conntrack state for similar purposes to socket state use cases, > >>>> as provided by the socket lookup helpers. This is particularly > >>>> useful when nf_conntrack state is locally available, but socket > >>>> state is not. > >>>> > >>>> Signed-off-by: Matthew Cover > >>>> --- > >>> > >>> Couple coding comments below. Also looks like a couple build errors > >>> so fix those up. I'm still thinking over this though. > >> > >> Thank you for taking the time to look this over. I will be looking > >> into the build issues. > > > > Looks like I missed static inline on a couple functions when > > nf_conntrack isn't builtin. I'll include the fix in v2. > > One of the big issues I'd see with this integration is that literally no-one > will be able to use it unless they manually recompile their distro kernel with > ct as builtin instead of module .. Have you considered writing a tcp/udp ct in > plain bpf? Perhaps would make sense to have some sort of tools/lib/bpf/util/ > with bpf prog library code that can be included. Daniel, sorry, I missed addressing your second point in my previous response. I agree that plain bpf ct is of interest. However, I still see value in these helpers, particularly when nf_conntrack is already in use. Reuse of info already in nf_conntrack avoids the memory cost of another ct table.