Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp860178pxb; Tue, 3 Nov 2020 14:41:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9+q3UBhgv+OF/zIzrDg0eQ/y+BB+VqoABZOgfRAN6pNnAz1VQnqAItaG1nsqG2zqwLowO X-Received: by 2002:a17:906:12cf:: with SMTP id l15mr23380550ejb.540.1604443301006; Tue, 03 Nov 2020 14:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604443300; cv=none; d=google.com; s=arc-20160816; b=EF+HSUJ+lNv/3fyK2pvrqDP1wVrlPmh3jqigbzoSaozk1ZOVoh+1crTnH6Blm3m55/ f0BMJFtAL9AwaKiKAwB8wOcj24bugBEctxvfESbq1WTz/aOrH7g5Mrfev9KX71DLhyAy NDNu9Q0XG+4VkWaG1z+JAXN9JUiny6Jb3ezF8o0SR8GP/SxDOZ6xinp8l0OeEjx6imZv Bb9C704mrVyygWq0P+BorZJWYMYWEy5TV/HcVPlkqG2Yu9wX62MS8GXvn6+Rmy2wNTOI e0AYo4nCr4sit2SIft7hASKKOt4Gyy8xSb20Zs6Ovw1QZxeilW1K1ts4zFIMyoUU0Y35 mCnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Q1fSjRxkdgdb3dJlgs3KGwewyjQPFNHGcFMIqXb2OR4=; b=p53HvquUkMF8QT/GgGpcWv6AUWUTYlbsgRKsLiSja/N1QrQjbzL7hjptQdWXgCQ1Sf l8twyPZfhOYWn6E5P51SUyj9xJ//P5VePEslhkSoU2qg/VsUCRr613tZHh5M+A7O4xek 5cLaOWtI4l6PriJQHExqYewbFponsztp/KF1E+YFsJfDlMUMfpTdCZpfG1RJtAyZYCuD vE66Xzb0gKM27KmwntwRlw4f8pZf+ILpWrt/Jj3gVem+y94ShkNSt0wfrmeZkD8WaboX tslQXEwD6XSqwaBlLAIRpqqbzx+s9BVOPIN8RbyvRlha7C05iXlVPPqyccJ1XsESjc3U 5/+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FtZ8meo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id a14si43773edn.216.2020.11.03.14.41.17; Tue, 03 Nov 2020 14:41:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FtZ8meo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1730374AbgKCWjz (ORCPT + 99 others); Tue, 3 Nov 2020 17:39:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729342AbgKCWjy (ORCPT ); Tue, 3 Nov 2020 17:39:54 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A08C0613D1; Tue, 3 Nov 2020 14:39:54 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id j12so5578406iow.0; Tue, 03 Nov 2020 14:39:54 -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=Q1fSjRxkdgdb3dJlgs3KGwewyjQPFNHGcFMIqXb2OR4=; b=FtZ8meo6Wv84NAh6ucBYC7C/wgd/hEk9mTHFtOuiif/RFtLceP/O8Njl5qH4GlaZK3 mWUXMMu6Dxh7p/3wYZoSRnMtXvmj+412+q6EOPfZ9MTMhCLBG4L5QE+AA97muzLyC8Bn p+k4EEPAqpM01xqsvoAYknkFPJUDdneKW/qaPDoINySAeFtg2WPB8gMfmAhiYNtHaZ4W 69kY8o6gmn0czqOkSVBTcVY3YQSl9FAPkXU6AMLSrK96WbH3Yo5xnm68XTILCjRj0I59 vzqr58gktr/posU2xzosEWNt6mevU6FM5HUjC+hxWyR+tzuf8dKdYgolt8IPhnXXP4Wj IKmQ== 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=Q1fSjRxkdgdb3dJlgs3KGwewyjQPFNHGcFMIqXb2OR4=; b=bZk+BlJqR6Z7N/33CAsARUD9gi21cvTUq+E9EPti9BXDLF2C0/1Hu1a40Bqi5+GA2H mOS1PPzUhIC8SWRdcvtfYhMBo2vYEP+NIQgQOeEgCBiPJISXmPfMJna/da5gbhSV1eJm K6M8K/I3+x/FxQmoR5VDiTyFbKWN4q/t4AXtnM0sgNuBbl7jg6cd3MgNKHF+vz38P6RB 2LsKg9qog2TG452upabOpHu7kppZqjq5zzb1okT5tFbThPPkuVtaiq219QM0Lf/IOjD8 48V8+aQmkOXOvxHrYIp0H9JOD5inyWu3S7KWOQoF6md3r7bUfY+VTNU/So2G+oCjUoEO O7ig== X-Gm-Message-State: AOAM530gKdF9vjh7NCN5rQWIjtbm8n82EYGSNQmcrvR/x1Xsiz1I81lp 5GqMSFSfP9WdlzGsHJReOEw= X-Received: by 2002:a6b:6016:: with SMTP id r22mr14997218iog.93.1604443193936; Tue, 03 Nov 2020 14:39:53 -0800 (PST) Received: from Davids-MacBook-Pro.local ([2601:282:803:7700:def:1f9b:2059:ffac]) by smtp.googlemail.com with ESMTPSA id u18sm78660iob.53.2020.11.03.14.39.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2020 14:39:53 -0800 (PST) Subject: Re: [net-next,v1,1/5] vrf: add mac header for tunneled packets when sniffer is attached To: Andrea Mayer , "David S. Miller" , David Ahern , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , Shuah Khan , Shrijeet Mukherjee , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: Stefano Salsano , Paolo Lungaroni , Ahmed Abdelsalam References: <20201103125242.11468-1-andrea.mayer@uniroma2.it> <20201103125242.11468-2-andrea.mayer@uniroma2.it> From: David Ahern Message-ID: Date: Tue, 3 Nov 2020 15:39:50 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201103125242.11468-2-andrea.mayer@uniroma2.it> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/3/20 5:52 AM, Andrea Mayer wrote: > Before this patch, a sniffer attached to a VRF used as the receiving > interface of L3 tunneled packets detects them as malformed packets and > it complains about that (i.e.: tcpdump shows bogus packets). > > The reason is that a tunneled L3 packet does not carry any L2 > information and when the VRF is set as the receiving interface of a > decapsulated L3 packet, no mac header is currently set or valid. > Therefore, the purpose of this patch consists of adding a MAC header to > any packet which is directly received on the VRF interface ONLY IF: > > i) a sniffer is attached on the VRF and ii) the mac header is not set. > > In this case, the mac address of the VRF is copied in both the > destination and the source address of the ethernet header. The protocol > type is set either to IPv4 or IPv6, depending on which L3 packet is > received. > > Signed-off-by: Andrea Mayer > --- > drivers/net/vrf.c | 78 +++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 72 insertions(+), 6 deletions(-) > Reviewed-by: David Ahern