Received: by 10.223.185.116 with SMTP id b49csp1078788wrg; Sat, 3 Mar 2018 14:58:59 -0800 (PST) X-Google-Smtp-Source: AG47ELt6v4Ca0FdrGwCuNMEp+BCLcxrrlu8NbqPKjPsGZvqvHwhoPwkT6Vc8f9CoSS5VgjWXjsy7 X-Received: by 10.99.127.65 with SMTP id p1mr8355127pgn.141.1520117939576; Sat, 03 Mar 2018 14:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520117939; cv=none; d=google.com; s=arc-20160816; b=hwQWbKf4n6QT0MuJ1XnXljc3aIxwH17l/9CO2z6hn9z5wt4CbLfgoCsqg7bhZORztA LFN1FMKT/S4veJv9nhZ2OeGIjOUdRcJ5GXqVKaj97vFjafBU0uZNjI7YoIqgO1+0CC0M vDhDih1NtFvUMhSVjlhjvQi99l2enFhX6pPZa+EHQ1hyTxK8vMM8ssSFiJ8wJ3EGWbKh qIB6U/RAem5v49XeKxdJHKP6xGFJ3EfaiHwQ1lB/4XHqWFVWbqA31tiNtPJzZoGBte4n WU6IAEJagqFg1ZRylRN3sI0H2ZD83aBUDezbOaiYhUQ2FfEaokAp7tDJIqEjpvT6fkIv SxIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=6Jty69X6xbpw7LWlkqNonxsyNAElVRQTQ4UZSH1EZcY=; b=SnNQDaxSNLPo/WmDCpXfi4kWZ2kBtuXXKDsYqLF3oLIv21k6IgF7UtenZ/2TTociAb q2uU/iVf5aEpWOafwwpNK997AzF+7aZb/XwL7DIJhu99qH3jHBDozYXJzo6Qi8vHNVtg mT3Sfs8V1bsn/CDKQVKbhi9MGjdH5QpdVDnvBgp+YNAfbhGHh+tJzsG4qCADekalsbIu 7MoRnghkUQe7jJvAhOOe4SG6HTDlRkGz44zl/JW0Gh5vDjUXuBPykm7XVFQrSuJkBo9Y sIHurgOBYy5WFvkn59VJQA8PcA02YDpKxuCFejCtuYRrT0wOKQTi4Q10VhVMFjkIZ/9z +0Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NHbSErm8; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11-v6si7136774pln.323.2018.03.03.14.58.45; Sat, 03 Mar 2018 14:58:59 -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=@microsoft.com header.s=selector1 header.b=NHbSErm8; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935447AbeCCW5t (ORCPT + 99 others); Sat, 3 Mar 2018 17:57:49 -0500 Received: from mail-cys01nam02on0109.outbound.protection.outlook.com ([104.47.37.109]:30112 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935343AbeCCWk4 (ORCPT ); Sat, 3 Mar 2018 17:40:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=6Jty69X6xbpw7LWlkqNonxsyNAElVRQTQ4UZSH1EZcY=; b=NHbSErm8wDmhYojwOHiPaCJgolDX67y0SxZSYVlWqKxzbFbls4h76Hi879Gg6JvGfDUlxdvPWk/RmJJweAkPl14mwTJlYO7T3rHp2PyDfGxjCkyO3VMJiI9apdR6zlsMMRweUWL2BoMNLffuIfRB+C+c+rlz1PnAW4F+zWiTs6E= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MWHSPR01MB344.namprd21.prod.outlook.com (10.174.251.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:40:53 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:40:53 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Mahesh Bandewar , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 113/115] ipvlan: add L2 check for packets arriving via virtual devices Thread-Topic: [PATCH AUTOSEL for 4.4 113/115] ipvlan: add L2 check for packets arriving via virtual devices Thread-Index: AQHTsz9wv3x2oDnM1E6mBSt9NKUR3g== Date: Sat, 3 Mar 2018 22:31:57 +0000 Message-ID: <20180303223010.27106-113-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHSPR01MB344;6:YkWJN3bmtAr+jhgpZEUeqD5rmp30JHC8oZmysNGN0MfD2aVuTOkRUY1n4u0FGgQQ/Y+QkpV4Ci3fxbmjEiAGVN2ll17Gcx3QxGOCtCswSqUb8ulkhIMT9HKfKrZltYkPyoovOdfLxTSnPdIlTAdu5k4w6CN223A1K+mC6sY1SSAi/2kqRs/1GUq36QdXfF2KXGMgNa8O9rT6LlckkpN6RwMsMPQlX+ALv5BBohsezx2a0oucpp9NN5VVK0mkynw6rqjIAzZ8Ko+WUm8SDKjqLF1Q77wotUY19GfgTfIDYS/LKMbkEl8QCewmIwrV7b7B4PtDU9IHQIDddXPzuTJkt29Kud+q1fElLbnWAHaCEcPFSj+OYFQbNriuIJaU4x9H;5:3QgHF4TDoQyMH47JXgu008tgsmTWrpd8zaZLv2aC6ExPm6RUiSDHZryB7RnfUxtlkq/xhQJEQZcnxQQef57LIWG5sFvsN4DbL3eWz7i6G7PV3LuS5Nazj2Nu3dBlONIbcP7O0hwYmOyg1EZ1I2D4VcExZL92JL2st/Ld662WBY8=;24:BxlRe+7n7XlIJ0pDVeNp1uW7TEciMbZdB8eYg3SSelFz6h18s4k6WhEmiJsWod9tFJ9TFbyT1uE6xKQfymz7eSf8P8lYJn2M1H5N6MaO5Jc=;7:KWkEi6oMANnmyx/0vGXjvAREzdtzZT/Pf42JkM/1+LiZTfgrY25W4Xpl3DErzVvjBXBnJvtlMSGOGkeZkykS+18kxgbcGoUHwKzRbSyK3NExGIBhpe+D5WLKcg9YdhH61iFCe0MRGSDAry/TUeCPyGsCBCQsNrsSfx2gDSvmRLyCWquscaHMgdXEZ225SZyrmpzR4J3gG1pFq3NXZgbhA6TvO0jg8AF6NLDtQ9NvKs8/+KZ/tPXw5FqGEX8g6WRK x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 672e2bf5-9aab-4ad8-c25f-08d58157d239 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MWHSPR01MB344; x-ms-traffictypediagnostic: MWHSPR01MB344: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(37575265505322)(28532068793085)(89211679590171)(211936372134217)(153496737603132); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3231220)(944501244)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:MWHSPR01MB344;BCL:0;PCL:0;RULEID:;SRVR:MWHSPR01MB344; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(346002)(39860400002)(366004)(39380400002)(189003)(199004)(8676002)(5660300001)(5250100002)(2501003)(6506007)(575784001)(7736002)(36756003)(25786009)(3846002)(6116002)(97736004)(305945005)(2900100001)(76176011)(6436002)(10090500001)(26005)(8936002)(186003)(81166006)(102836004)(81156014)(106356001)(86362001)(10290500003)(3660700001)(2906002)(99286004)(14454004)(86612001)(105586002)(478600001)(4326008)(6486002)(53936002)(107886003)(68736007)(316002)(54906003)(110136005)(6512007)(72206003)(3280700002)(22452003)(2950100002)(1076002)(66066001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHSPR01MB344;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: bI43fRJQTmeADte/qIz2vPwsJVrYsWivPy7MjFAYTY0lNiGmaJoURVm7yaINA3qsAoh7ejtsw0+Nimgh7Nsm4lww8uyxwUIKl7h9QbXk6XHj8N6xdhMo8AzUd4PXTnyI/RC/XsfuunJcuGd20Amn+Py6b9QVs9ABX3O8Qb3Eoek= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 672e2bf5-9aab-4ad8-c25f-08d58157d239 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:31:57.1520 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHSPR01MB344 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/ipvlan/ipvlan_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_c= ore.c index 8aecea0d5dbf..142015af43db 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -282,6 +282,10 @@ static int ipvlan_rcv_frame(struct ipvl_addr *addr, st= ruct sk_buff **pskb, if (dev_forward_skb(ipvlan->dev, skb) =3D=3D NET_RX_SUCCESS) success =3D true; } else { + if (!ether_addr_equal_64bits(eth_hdr(skb)->h_dest, + ipvlan->phy_dev->dev_addr)) + skb->pkt_type =3D PACKET_OTHERHOST; + ret =3D RX_HANDLER_ANOTHER; success =3D true; } --=20 2.14.1