Received: by 10.213.65.68 with SMTP id h4csp472570imn; Fri, 16 Mar 2018 08:48:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELtvG60s9mULXZuleXKLDhomg3tnUVfmtkRO9kcN9OWQSIYpR5jce68mrBPmnVZsec6Dw0lB X-Received: by 10.98.76.26 with SMTP id z26mr1983534pfa.220.1521215322868; Fri, 16 Mar 2018 08:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215322; cv=none; d=google.com; s=arc-20160816; b=xphs1H8/NT1ybMDOTQBMZpF6Bg2QvoL4yZs19W9sL6bRbg5A9OJteHzN4vNGFo4h1Z E4Yny7D3S3KhKxlVV0JTyoQcT1JI17D5no2lArdTlqKYBX6D6fMY2axv/4Fpac9IvKCk CHlbZWmrJnstrZzSHsdvsJrGl00u6Lr+VO16/bT8Mg2monzbTb6uH6RqGDx2OCtBMsFC pb0+g8diqDMn6KOdW5muS3AzohmggBBs9wdUNXL85GbjlTpiUwajrZuoRrRmC+t1CNQY SJkvHXxc7ZeaJr4jrpkXGEmcI5fgfFn9Cqji4AUp+PqDBYwwWgU+aGFbaOji1CV1u4fG j3QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jKiQkc5uKKa+S2kjl+3SfpqYIlDMEEDmu/kb7zYEKCE=; b=zXmyR+L+AKwQt2vJ8ZaTKFjr4RD/iIEmrT+FWCVYp1BUP6zA77eKgJZYLL5BqUkjNQ TaMBDAojl9tiOY7CtRw/Zdpkw0ngjYxMZOUJm5c3uBNMOIv1RdMu2yAVLaapbrsSJKxn 7wiUmFEi9O87NiTGxXmgQZgfL6yMSMEhLFC4YkaS97V+zE/sYzTS3qZ1em1QjGOjEJ54 EEUATRdoYShafWiWHh0WkirZ9DajpXbAmX6I4wTaspV6z9mKqNkAVHV6DRn/Wtkvn8Xa KubxpP3MTheXkE+yBkv3yvLOGPTm9m83YIYOckP3nRc5BH8RnAdQcez21E/o5aFordJV W3Hw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si5684503pfl.176.2018.03.16.08.48.28; Fri, 16 Mar 2018 08:48:42 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965493AbeCPPqC (ORCPT + 99 others); Fri, 16 Mar 2018 11:46:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46296 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934430AbeCPPpT (ORCPT ); Fri, 16 Mar 2018 11:45:19 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5E484D8E; Fri, 16 Mar 2018 15:45:18 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amit Sikka , Mahesh Bandewar , "David S. Miller" , Sasha Levin Subject: [PATCH 4.15 122/128] ipvlan: add L2 check for packets arriving via virtual devices Date: Fri, 16 Mar 2018 16:24:23 +0100 Message-Id: <20180316152342.514138115@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mahesh Bandewar [ Upstream commit 92ff42645028fa6f9b8aa767718457b9264316b4 ] Packets that don't have dest mac as the mac of the master device should not be entertained by the IPvlan rx-handler. This is mostly true as the packet path mostly takes care of that, except when the master device is a virtual device. As demonstrated in the following case - ip netns add ns1 ip link add ve1 type veth peer name ve2 ip link add link ve2 name iv1 type ipvlan mode l2 ip link set dev iv1 netns ns1 ip link set ve1 up ip link set ve2 up ip -n ns1 link set iv1 up ip addr add 192.168.10.1/24 dev ve1 ip -n ns1 addr 192.168.10.2/24 dev iv1 ping -c2 192.168.10.2 ip neigh show dev ve1 ip neigh show 192.168.10.2 lladdr dev ve1 ping -c2 192.168.10.2 This patch adds that missing check in the IPvlan rx-handler. Reported-by: Amit Sikka Signed-off-by: Mahesh Bandewar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ipvlan/ipvlan_core.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -322,6 +322,10 @@ static int ipvlan_rcv_frame(struct ipvl_ if (dev_forward_skb(ipvlan->dev, skb) == NET_RX_SUCCESS) success = true; } else { + if (!ether_addr_equal_64bits(eth_hdr(skb)->h_dest, + ipvlan->phy_dev->dev_addr)) + skb->pkt_type = PACKET_OTHERHOST; + ret = RX_HANDLER_ANOTHER; success = true; }