Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp265192img; Mon, 18 Mar 2019 02:36:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1qvoIX89ADtZ0D20F+FThe6FSjuHq+xEchCtMeIbCidtjAXR9KDk+HHYKxtg10RGfkOlc X-Received: by 2002:a65:6259:: with SMTP id q25mr16857428pgv.235.1552901808922; Mon, 18 Mar 2019 02:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552901808; cv=none; d=google.com; s=arc-20160816; b=c9ay3yg9dOlGTXuQFfKGyOR8r5Jnrqxagc2JsIzh6YQbfUQ7E/5Wk0cnxVGfLrRyud ls86r4wmfKZUplrJIOOuFH8cGtrDZ+r0ASPKs9IGdVI+gEgQgsOaJIFv/KfLuAvS581S 3fgxG5dzHFjU13d805anJO7A4ycsQI3f2wp2/aFAdOTNxEcPPkG8v5lg58Y2zM/C0K4d mbVvM0ZlMyAINTf3xeW8Urq9tprkFvYelmhQNsDGcjr6MAx7gKjoCtRI1Vi9EUigq8s3 vkSA1WTJuB0pmKoYf45XRyIzZmpLtecYBcnbZamTcI7Ez6NWublFpG83KafFbOwlH+oQ Kp3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VkSPa2MPIu09YlUEGpZKlKFulbnThd2vpwcageWzOug=; b=Z+kLNwN+BKknWMjcq4dMwa4CMDKSmoeiK0PVv2Gvlt1ceHOCcIlDBEdd3f14av+Jed ppXldbqZm7ekbAtEGq5lWIX4JTPVoZ8wHY2Fi62FKT/oWYhyThEyMYbPnwELrU2B7cmy 0HN0A4/FB5dCHoC6BMdHy/P9mqCC5q2dYvcQ7XGZIpN7dKt6+2uSYULRySS3ILU1pCg7 JN1uVnor8wRht1Cu7BLMZPZiWcdLJWDD4O/KsRPfgHSwLv6CkIX6tajm9/9KDGhAqeLw 1hMs3mKYy3yXrpGjKFMbujY++a9z0kj+NAHEdcaUZscwm8w6Lwe4Eim1NE2mPMpbfPS+ 4WHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="rx/7Sk2r"; 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 q5si8392831pgj.382.2019.03.18.02.36.33; Mon, 18 Mar 2019 02:36:48 -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; dkim=pass header.i=@kernel.org header.s=default header.b="rx/7Sk2r"; 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 S1728827AbfCRJfP (ORCPT + 99 others); Mon, 18 Mar 2019 05:35:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:43584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729077AbfCRJfO (ORCPT ); Mon, 18 Mar 2019 05:35:14 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DAE532075C; Mon, 18 Mar 2019 09:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552901713; bh=VwaZCgrpFO30aYQBeiFJ7gaIDkcRvmVJ0FvyMTKrmA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rx/7Sk2rTS2pxnqr4cJoX5DUOg6D126AfSxTdCwdJwZYVj0QmjvPF6Rm8Uiz8BQC5 qxo1n/L+i5mQGNb/7NjwnRb4s9svf1kQ+jK4rs+OcT4pRPlgA3zHbPGPBle3yCAmev 9P9I38x0UOabLZLyqZqkK5NxtUszzA6GvROG5FnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Bernat , Michal Soltys , =?UTF-8?q?Maciej=20=C5=BBenczykowski?= , "David S. Miller" Subject: [PATCH 4.14 25/34] bonding: fix PACKET_ORIGDEV regression Date: Mon, 18 Mar 2019 10:25:49 +0100 Message-Id: <20190318084148.238318296@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190318084144.657740413@linuxfoundation.org> References: <20190318084144.657740413@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michal Soltys [ Upstream commit 3c963a3306eada999be5ebf4f293dfa3d3945487 ] This patch fixes a subtle PACKET_ORIGDEV regression which was a side effect of fixes introduced by: 6a9e461f6fe4 bonding: pass link-local packets to bonding master also. ... to: b89f04c61efe bonding: deliver link-local packets with skb->dev set to link that packets arrived on While 6a9e461f6fe4 restored pre-b89f04c61efe presence of link-local packets on bonding masters (which is required e.g. by linux bridges participating in spanning tree or needed for lab-like setups created with group_fwd_mask) it also caused the originating device information to be lost due to cloning. Maciej Żenczykowski proposed another solution that doesn't require packet cloning and retains original device information - instead of returning RX_HANDLER_PASS for all link-local packets it's now limited only to packets from inactive slaves. At the same time, packets passed to bonding masters retain correct information about the originating device and PACKET_ORIGDEV can be used to determine it. This elegantly solves all issues so far: - link-local packets that were removed from bonding masters - LLDP daemons being forced to explicitly bind to slave interfaces - PACKET_ORIGDEV having no effect on bond interfaces Fixes: 6a9e461f6fe4 (bonding: pass link-local packets to bonding master also.) Reported-by: Vincent Bernat Signed-off-by: Michal Soltys Signed-off-by: Maciej Żenczykowski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/bonding/bond_main.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -1177,29 +1177,22 @@ static rx_handler_result_t bond_handle_f } } - /* Link-local multicast packets should be passed to the - * stack on the link they arrive as well as pass them to the - * bond-master device. These packets are mostly usable when - * stack receives it with the link on which they arrive - * (e.g. LLDP) they also must be available on master. Some of - * the use cases include (but are not limited to): LLDP agents - * that must be able to operate both on enslaved interfaces as - * well as on bonds themselves; linux bridges that must be able - * to process/pass BPDUs from attached bonds when any kind of - * STP version is enabled on the network. + /* + * For packets determined by bond_should_deliver_exact_match() call to + * be suppressed we want to make an exception for link-local packets. + * This is necessary for e.g. LLDP daemons to be able to monitor + * inactive slave links without being forced to bind to them + * explicitly. + * + * At the same time, packets that are passed to the bonding master + * (including link-local ones) can have their originating interface + * determined via PACKET_ORIGDEV socket option. */ - if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) { - struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); - - if (nskb) { - nskb->dev = bond->dev; - nskb->queue_mapping = 0; - netif_rx(nskb); - } - return RX_HANDLER_PASS; - } - if (bond_should_deliver_exact_match(skb, slave, bond)) + if (bond_should_deliver_exact_match(skb, slave, bond)) { + if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) + return RX_HANDLER_PASS; return RX_HANDLER_EXACT; + } skb->dev = bond->dev;