Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5996108ybc; Wed, 27 Nov 2019 13:06:38 -0800 (PST) X-Google-Smtp-Source: APXvYqx7no7E7E5ijPQ4krXa7EQLdl4zfER9tQD4yElP3ccda+EbBixPABlfkzPQlT6xRMLRumtI X-Received: by 2002:aa7:d6c8:: with SMTP id x8mr4589007edr.300.1574888798689; Wed, 27 Nov 2019 13:06:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888798; cv=none; d=google.com; s=arc-20160816; b=AUS/gYFtbffH/yXspKyatOG5EWQhSvkB0wMsGMp77AjTbTmWad9HixB1xCyYZgfixk tu0YxjY6HJnIPK3Dc3H1n9aWhibDta84yyuUeN1E91A/VkOn2llvn5GKGTKJQ854FatE yUCNAc9srBXvdUA2keN6xgl4n0QqydubR/+ZLa/7xQ9D6leRtxIzQ9s9CYicUKmf5POk MaYeONsUUHUkuH55CcMbUysI2VXcUAshyMeHrmXojG644x2xCOkP8HHVPGDFjfEVFj3D xPmSoaCTuIVZtGvcwGELUnpq3p0szfj5A6IWFl0qu85f4iRPsOA/28wYfqTdfASiUOSk tr8g== 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=RHTdHXSGSX0U02DI2rkB1UGCgzhBQr2t+5sdG8H9nvg=; b=S+Y1Iv38jIvfYrrF57TT3A8iNDr4wcr3weNlj4kbULzlqOVZeilIyKXIGQmSgv8VRD 3SRh8g8htvs4AvzEdkW8cOwDplHf2jMPgQkdIWJ+QqvSuQfgjaenWrhmTnsCGRTFENam Diuq4K14Isj4HlNEFBKir16nlBqL5mX7K9ZD8VmsmpeDDQCdeZg1cLXFkDKX8dZ8W+8t gb7tw9kSdEnyTnhQPM5KvjixnVviAcPwf1Oeb5SPF5xESQ4Iz5toIMXdf2+5uoneV08b 0El1WZlE/2NKJsCQY3sk5XSyNt4HFUQzg9z52bC7pYd34MZquXTKjkhelFqk3YehSazi nkag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Og3m16eV; 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 a14si1915609edr.215.2019.11.27.13.06.15; Wed, 27 Nov 2019 13:06:38 -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=@kernel.org header.s=default header.b=Og3m16eV; 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 S1731667AbfK0VDM (ORCPT + 99 others); Wed, 27 Nov 2019 16:03:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:56262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732006AbfK0VDK (ORCPT ); Wed, 27 Nov 2019 16:03:10 -0500 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 34E5421569; Wed, 27 Nov 2019 21:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888589; bh=xy9fV6VRf6ZTjqVGfwmNG4IyHl8ycEZP8gaaGlsnQeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Og3m16eVWE7dRvg7JHDCJdu5FhhqlabChg6XPep8wQQyhVjii7t8Sl/lGUKToI/Su mLVIVu2zV2XQr/JpX8Q1hWgLApCqOnw8aKVz6MqeTSP2jJrYm2Z4S7sStfr1a40VT0 KF+SPoSoWtRgAk+afqCk0Pghg47Dq9kiuyQGodHk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Radu Rendec , Patrick Talbert , Sabrina Dubroca , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 151/306] macsec: update operstate when lower device changes Date: Wed, 27 Nov 2019 21:30:01 +0100 Message-Id: <20191127203126.714967921@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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: Sabrina Dubroca [ Upstream commit e6ac075882b2afcdf2d5ab328ce4ab42a1eb9593 ] Like all other virtual devices (macvlan, vlan), the operstate of a macsec device should match the state of its lower device. This is done by calling netif_stacked_transfer_operstate from its netdevice notifier. We also need to call netif_stacked_transfer_operstate when a new macsec device is created, so that its operstate is set properly. This is only relevant when we try to bring the device up directly when we create it. Radu Rendec proposed a similar patch, inspired from the 802.1q driver, that included changing the administrative state of the macsec device, instead of just the operstate. This version is similar to what the macvlan driver does, and updates only the operstate. Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver") Reported-by: Radu Rendec Reported-by: Patrick Talbert Signed-off-by: Sabrina Dubroca Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/macsec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 05115fb0c97a9..50acd8c9d7f53 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -3305,6 +3305,9 @@ static int macsec_newlink(struct net *net, struct net_device *dev, if (err < 0) goto del_dev; + netif_stacked_transfer_operstate(real_dev, dev); + linkwatch_fire_event(dev); + macsec_generation++; return 0; @@ -3489,6 +3492,20 @@ static int macsec_notify(struct notifier_block *this, unsigned long event, return NOTIFY_DONE; switch (event) { + case NETDEV_DOWN: + case NETDEV_UP: + case NETDEV_CHANGE: { + struct macsec_dev *m, *n; + struct macsec_rxh_data *rxd; + + rxd = macsec_data_rtnl(real_dev); + list_for_each_entry_safe(m, n, &rxd->secys, secys) { + struct net_device *dev = m->secy.netdev; + + netif_stacked_transfer_operstate(real_dev, dev); + } + break; + } case NETDEV_UNREGISTER: { struct macsec_dev *m, *n; struct macsec_rxh_data *rxd; -- 2.20.1