Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1509523ybb; Sat, 11 Apr 2020 05:16:55 -0700 (PDT) X-Google-Smtp-Source: APiQypI2Il67ve95OalEuTj/DXzMboP0YHlRHHcBiSsoFh/Cy9dBX9J9JrtJ+FHWBn6FejE+N7j+ X-Received: by 2002:a05:620a:387:: with SMTP id q7mr8088596qkm.193.1586607415552; Sat, 11 Apr 2020 05:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586607415; cv=none; d=google.com; s=arc-20160816; b=tC+Jl8dOgL1ALGfkECuG4CtPsLiuTIZsBbbVWlgYmAyjW0uo7GMXV+gHBswfQD6+sP UrXrSFT+dGEc6piq1MLSjAOPMlmfWgRjOf4wAciJXvZLG8HFKn5nJnI8IzaCVipSMCOI RlHo6V6qRMxkRoquPTbUcDBd44bv5gvZplxbeQFq0bJG0o2KEfQ+uJvE6sedI7iI857P 7HyZK8bJPNCJpECjxMxkXABKApSkBp45XBlEXpoPBK4pdyx5KKJf8oi9+Kf4CdoosWmE MGPz+6suEGNElC5s1YxCupYJmCFfzBtsIAEukyM3cfEPHSdv2MbHIHUjk6MUghTjoCe0 FBeA== 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=ZlU6N5wfxWMRiwpQC6owCScntCmVmhVnX6ptdx+pT7E=; b=B7dmC3WENkCISgI7lRDEzn5VCtOkp2xUhQXGQPR+gkOJOfYdeAlN/WPVbZoIBb23jA 7WFwbKF3dwqAq2LELdPspXT1zAk62bgYOrfDCH7FZK+kf8fUhOpozuFP/jo/mVwo6dW6 jDciijtHnPIpsWFpwtiMqiXv7p45bDd9fDy7ZlMvFZwOo3458lc0ulOl66CAreYELcWQ 1Ccfgyu3eJS21yQu9KwzMto5r4xBjR1yFrVbgE1Ef4Iz3ZLHrNBFGu7O6Q7bddka8W+N E4gRohch/J6hxHLww4jyz1TUnRlqJi5DIW5Dqt1DJ3EqfTAOWdX5M6McCjUDIB9lgEt3 RK2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YjyakbU3; 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 12si3402229qtp.98.2020.04.11.05.16.40; Sat, 11 Apr 2020 05:16:55 -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=YjyakbU3; 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 S1727261AbgDKMP1 (ORCPT + 99 others); Sat, 11 Apr 2020 08:15:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:49316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727181AbgDKMPZ (ORCPT ); Sat, 11 Apr 2020 08:15:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 9B29C21655; Sat, 11 Apr 2020 12:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607325; bh=bUKIwhqr/I1zZj3MIfidzAKGc3BlyDNM+bhRPyedYz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YjyakbU3x04TquuqK0aPptmvK9v2A++njv3YTnZ+/U9p3X3t5O+3eeTsBv+WSwQGm jiq9YJl75nYCGk74lWztaoh7jlkrQM+vFk/zetlJFgC0CDHAQnJtX/OV1wusP2M0kK typbdsFF6I0fSCJlDsZjo9YtFS5+PrOoQooJBXpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Moshe Levi , Stephen Hemminger , Marcelo Ricardo Leitner , netdev@vger.kernel.org, Jarod Wilson , "David S. Miller" Subject: [PATCH 4.19 28/54] ipv6: dont auto-add link-local address to lag ports Date: Sat, 11 Apr 2020 14:09:10 +0200 Message-Id: <20200411115511.324846089@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200411115508.284500414@linuxfoundation.org> References: <20200411115508.284500414@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Jarod Wilson [ Upstream commit 744fdc8233f6aa9582ce08a51ca06e59796a3196 ] Bonding slave and team port devices should not have link-local addresses automatically added to them, as it can interfere with openvswitch being able to properly add tc ingress. Basic reproducer, courtesy of Marcelo: $ ip link add name bond0 type bond $ ip link set dev ens2f0np0 master bond0 $ ip link set dev ens2f1np2 master bond0 $ ip link set dev bond0 up $ ip a s 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens2f0np0: mtu 1500 qdisc mq master bond0 state UP group default qlen 1000 link/ether 00:0f:53:2f:ea:40 brd ff:ff:ff:ff:ff:ff 5: ens2f1np2: mtu 1500 qdisc mq master bond0 state DOWN group default qlen 1000 link/ether 00:0f:53:2f:ea:40 brd ff:ff:ff:ff:ff:ff 11: bond0: mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:0f:53:2f:ea:40 brd ff:ff:ff:ff:ff:ff inet6 fe80::20f:53ff:fe2f:ea40/64 scope link valid_lft forever preferred_lft forever (above trimmed to relevant entries, obviously) $ sysctl net.ipv6.conf.ens2f0np0.addr_gen_mode=0 net.ipv6.conf.ens2f0np0.addr_gen_mode = 0 $ sysctl net.ipv6.conf.ens2f1np2.addr_gen_mode=0 net.ipv6.conf.ens2f1np2.addr_gen_mode = 0 $ ip a l ens2f0np0 2: ens2f0np0: mtu 1500 qdisc mq master bond0 state UP group default qlen 1000 link/ether 00:0f:53:2f:ea:40 brd ff:ff:ff:ff:ff:ff inet6 fe80::20f:53ff:fe2f:ea40/64 scope link tentative valid_lft forever preferred_lft forever $ ip a l ens2f1np2 5: ens2f1np2: mtu 1500 qdisc mq master bond0 state DOWN group default qlen 1000 link/ether 00:0f:53:2f:ea:40 brd ff:ff:ff:ff:ff:ff inet6 fe80::20f:53ff:fe2f:ea40/64 scope link tentative valid_lft forever preferred_lft forever Looks like addrconf_sysctl_addr_gen_mode() bypasses the original "is this a slave interface?" check added by commit c2edacf80e15, and results in an address getting added, while w/the proposed patch added, no address gets added. This simply adds the same gating check to another code path, and thus should prevent the same devices from erroneously obtaining an ipv6 link-local address. Fixes: d35a00b8e33d ("net/ipv6: allow sysctl to change link-local address generation mode") Reported-by: Moshe Levi CC: Stephen Hemminger CC: Marcelo Ricardo Leitner CC: netdev@vger.kernel.org Signed-off-by: Jarod Wilson Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv6/addrconf.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3241,6 +3241,10 @@ static void addrconf_addr_gen(struct ine if (netif_is_l3_master(idev->dev)) return; + /* no link local addresses on devices flagged as slaves */ + if (idev->dev->flags & IFF_SLAVE) + return; + ipv6_addr_set(&addr, htonl(0xFE800000), 0, 0, 0); switch (idev->cnf.addr_gen_mode) {