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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS 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 4CA1FC282C4 for ; Thu, 7 Feb 2019 14:20:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 278D921908 for ; Thu, 7 Feb 2019 14:20:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbfBGOUx (ORCPT ); Thu, 7 Feb 2019 09:20:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35788 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbfBGOUw (ORCPT ); Thu, 7 Feb 2019 09:20:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 935EF356F5; Thu, 7 Feb 2019 14:20:51 +0000 (UTC) Received: from carbon (ovpn-200-42.brq.redhat.com [10.40.200.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id B286F6155B; Thu, 7 Feb 2019 14:20:43 +0000 (UTC) Date: Thu, 7 Feb 2019 15:20:42 +0100 From: Jesper Dangaard Brouer To: Peter Oskolkov Cc: brouer@redhat.com, Alexei Starovoitov , Daniel Borkmann , netdev@vger.kernel.org, Peter Oskolkov , David Ahern , Willem de Bruijn Subject: Re: [PATCH bpf-next v7 1/6] bpf: add plumbing for BPF_LWT_ENCAP_IP in bpf_lwt_push_encap Message-ID: <20190207152042.18a97a71@carbon> In-Reply-To: <20190207003720.51096-2-posk@google.com> References: <20190207003720.51096-1-posk@google.com> <20190207003720.51096-2-posk@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Feb 2019 14:20:52 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 6 Feb 2019 16:37:15 -0800 Peter Oskolkov wrote: > This patch adds all needed plumbing in preparation to allowing > bpf programs to do IP encapping via bpf_lwt_push_encap. Actual > implementation is added in the next patch in the patchset. > > Of note: > - bpf_lwt_push_encap can now be called from BPF_PROG_TYPE_LWT_XMIT > prog types in addition to BPF_PROG_TYPE_LWT_IN; > - if the skb being encapped has GSO set, encapsulation is limited > to IPIP/IP+GRE/IP+GUE (both IPv4 and IPv6); > - as route lookups are different for ingress vs egress, the single > external bpf_lwt_push_encap BPF helper is routed internally to > either bpf_lwt_in_push_encap or bpf_lwt_xmit_push_encap BPF_CALLs, > depending on prog type. > > Signed-off-by: Peter Oskolkov > --- > include/uapi/linux/bpf.h | 26 +++++++++++++++++++++-- > net/core/filter.c | 46 +++++++++++++++++++++++++++++++++++----- > 2 files changed, 65 insertions(+), 7 deletions(-) > > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h > index 1777fa0c61e4..138089ff24cf 100644 > --- a/include/uapi/linux/bpf.h > +++ b/include/uapi/linux/bpf.h > @@ -2016,6 +2016,19 @@ union bpf_attr { > * Only works if *skb* contains an IPv6 packet. Insert a > * Segment Routing Header (**struct ipv6_sr_hdr**) inside > * the IPv6 header. > + * **BPF_LWT_ENCAP_IP** > + * IP encapsulation (GRE/GUE/IPIP/etc). The outer header > + * must be IPv4 or IPv6, followed by zero or more > + * additional headers, up to LWT_BPF_MAX_HEADROOM total > + * bytes in all prepended headers. PLease note that ^^ Trivial typo PLease > + * if skb_is_gso(skb) is true, no more than two headers > + * can be prepended, and the inner header, if present, > + * should be either GRE or UDP/GUE. > +