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=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 63383C169C4 for ; Wed, 30 Jan 2019 03:29:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 289302087F for ; Wed, 30 Jan 2019 03:29:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="snkcRkWf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728580AbfA3D3R (ORCPT ); Tue, 29 Jan 2019 22:29:17 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37045 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbfA3D3Q (ORCPT ); Tue, 29 Jan 2019 22:29:16 -0500 Received: by mail-pf1-f196.google.com with SMTP id y126so10739345pfb.4 for ; Tue, 29 Jan 2019 19:29:16 -0800 (PST) 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=fxIcPXLsUrjklUuXDevXE6Wby5gMqpIRR79K+S0+ZVU=; b=snkcRkWfViOA+ekC6XZzhZnWZpQ5v7ztDyuljoOZeCQYLPLkon66fOsKECJEG1+LF1 KAyRbYRp7vrFvKbo7gXtmJdkMyHN6LDL6sP0DNRti50cFxyWGb4xGhbFfOJuWCR2wy6T uIajQ7I8uwlw8/TaYjoV2NY17QR6mWadXXydaM0DMChHNBaJmLRueN6An0TeWr2K6Uw3 UTC07ShpETcIRUhV1+Yc0kz2rpf0Caf4H7CGhu0qHAOz+J9+WYC2VPNBTvvDcibK/JaN Mru/4j4BAHDVAfJ7igrdyRoVpr631c1rXQ1cy8UERLo+8VjplU5673mqdNa14h3rTWDV OkCQ== 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=fxIcPXLsUrjklUuXDevXE6Wby5gMqpIRR79K+S0+ZVU=; b=XBSOn0QVCkd2ArO68e093qqhCJURa6IjLeWQlvr2j0Nt1bBh5XI1jMWhrlnl3Y1fbX sm/3k67PMH4ezR6nZG8vpULqwiIfpEaAddPVHOmgmd6Ayu+56MTm7rP/jUPeZhrhRN1h vcqo1zpTkwxV3sd2PTbc31qB0f7jAB+dvAtuiXJl4q94c0k9mwgL6L4K0S09v21W9PIh v7c4yuke0q7q1iMQjiA92Yd+7vaTd7WCM6jxM+JLAxh4kGeHwD44Vlv+MHiCy7El7fLo MxXATLK80aNJRlTumpAiBhkjhIMZ6EUWCKe87RrHnAfxI1DsHfPnFMbfqy5RkPe6EeoV qrOw== X-Gm-Message-State: AJcUukdiqZwVIIu4TiN3y5ZqyE5mANECBkxYSrWN/5Y8aE9D1DCiRjjJ 5FES7tCQeksVJ6jWNpoMN+s= X-Google-Smtp-Source: ALg8bN7yWVfwtPjTdNbtuXSlj+z6X3JAZO0dUchp7jghTTfxpT74cVpNktxJmDPTEIV2J5uFBLvgEw== X-Received: by 2002:a62:47d9:: with SMTP id p86mr28197809pfi.95.1548818955713; Tue, 29 Jan 2019 19:29:15 -0800 (PST) Received: from ?IPv6:2601:282:800:fd80:edc4:6e9f:eba1:f2a3? ([2601:282:800:fd80:edc4:6e9f:eba1:f2a3]) by smtp.googlemail.com with ESMTPSA id m85sm297150pfj.171.2019.01.29.19.29.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 19:29:14 -0800 (PST) Subject: Re: [PATCH bpf-next v3 1/4] bpf: add plumbing for BPF_LWT_ENCAP_IP in bpf_lwt_push_encap To: Peter Oskolkov , Alexei Starovoitov , Daniel Borkmann , netdev@vger.kernel.org Cc: Peter Oskolkov , Willem de Bruijn References: <20190129011217.192510-1-posk@google.com> <20190129011217.192510-2-posk@google.com> From: David Ahern Message-ID: Date: Tue, 29 Jan 2019 20:29:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190129011217.192510-2-posk@google.com> 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 1/28/19 6:12 PM, Peter Oskolkov wrote > @@ -2583,7 +2594,15 @@ enum bpf_ret_code { > BPF_DROP = 2, > /* 3-6 reserved */ > BPF_REDIRECT = 7, > - /* >127 are reserved for prog type specific return codes */ > + /* >127 are reserved for prog type specific return codes. > + * > + * BPF_LWT_REROUTE: used by BPF_PROG_TYPE_LWT_IN and > + * BPF_PROG_TYPE_LWT_XMIT to indicate that skb's dst > + * has changed and appropriate dst_input() or dst_output() > + * action has to be taken (this is an L3 redirect, as > + * opposed to L2 redirect represented by BPF_REDIRECT above). > + */ > + BPF_LWT_REROUTE = 128, > }; What happens if a program pushes a new header onto the skb and does not return BPF_LWT_REROUTE? Might be better to move the route lookup and dst swap to run_lwt_bpf and only do it if the program returns BPF_LWT_REROUTE. That allows calling bpf_push_ip_encap without requiring a route lookup. That might be fine as long as their is not a protocol mismatch (ipv4 packet gets an ipv6 header or vice versa). But then, I think you have the mismatch problem now if the program does not return BPF_LWT_REROUTE.