Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2987635pxb; Mon, 16 Nov 2020 02:44:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbuLGt12gPW6gOBvDqKh8aC8EHsMwBEk856Up+vqq8+uGICrwkS9PvWWxZxq9Dc26Qdo+o X-Received: by 2002:a50:99c3:: with SMTP id n3mr15441352edb.213.1605523497722; Mon, 16 Nov 2020 02:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605523497; cv=none; d=google.com; s=arc-20160816; b=OKmAmOXdu0GG7N+o/B9juxZtmBfyLI+DhLHGTvd/5p70MX0BY8FytlrGc5MmOhzI0+ ajnNvvIzkJTcsa5fBOBrRLzi69z0kquOq9hpqnnHRsG+Q9pkAHsfGbEckceDFfVDQo5J DVQuD57Yv6a8+LK6hAe3+8NpFExIKdrwRy6HTw266R1doWqKCR6RnG8OwdzaLG89x6zg V+lVIiRi99PSMZ1X1NItVhSH8tPdkHtxkj6J5Xox6XXD6fscXnObW/gA7YRc9DtFoIY/ Cf4/4cRKE9MTQ5CD9slwE7zMj1p9XUrhTxV8QnPeOiWOADlRxYxdDbgDVvrv9o3EKhPQ /bkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=YaDb70XMib/j7hBNB7/Du8+4IunH0Hzg9PERfKN34PA=; b=rnOycz/qndkop197CzRnjZT6m1MpR5UqDP/TbdKeHtwnThWrCwY2ZiF8OJt5aHBdVD bp2WnqB54UFBk7YscYWqxHcoxnYmX12L3KnI/LeAIQ2p7W6PsAd/RDdZFzmNxkkotfjB YV+n/3dGu2iseiu8f1hHRloorRF3vcduc4xCE4fNgLq1y7avR/R2py12MTrmw3wJ+FSf dKNcIp16RuaRALVPQLWuYavHZKS0hmJ9Sj8UlWajFZfvKzWAv7lVNGyYwp30NO7fF5F9 EOdiGyCbxjpPshxo0Wvhj7ZLKtbrWh4uxV7KTZ0F1XsPirXtS0Mkb8qh4Q+zWA2FQmjD o2tQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si2796387edx.432.2020.11.16.02.44.33; Mon, 16 Nov 2020 02:44:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728980AbgKPKld (ORCPT + 99 others); Mon, 16 Nov 2020 05:41:33 -0500 Received: from mxout70.expurgate.net ([91.198.224.70]:30151 "EHLO mxout70.expurgate.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726889AbgKPKlc (ORCPT ); Mon, 16 Nov 2020 05:41:32 -0500 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1kebwt-0008hw-Ty; Mon, 16 Nov 2020 11:41:27 +0100 Received: from [195.243.126.94] (helo=securemail.tdt.de) by relay.expurgate.net with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kebwt-0004Ut-74; Mon, 16 Nov 2020 11:41:27 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id EBE7B240049; Mon, 16 Nov 2020 11:41:26 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 90BC9240047; Mon, 16 Nov 2020 11:41:26 +0100 (CET) Received: from mschiller01.dev.tdt.de (unknown [10.2.3.20]) by mail.dev.tdt.de (Postfix) with ESMTPSA id 524FC21E6A; Mon, 16 Nov 2020 11:41:26 +0100 (CET) From: Martin Schiller To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Martin Schiller Subject: [PATCH net-next v3] net/tun: Call netdev notifiers Date: Mon, 16 Nov 2020 11:41:21 +0100 Message-ID: <20201116104121.20884-1-ms@dev.tdt.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.dev.tdt.de Content-Transfer-Encoding: quoted-printable X-purgate-type: clean X-purgate: clean X-purgate-ID: 151534::1605523287-00014126-C1E0DC53/0/0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call netdev notifiers before and after changing the device type. Signed-off-by: Martin Schiller --- Change from v2: use subject_prefix 'net-next' to fix 'fixes_present' issue Change from v1: fix 'subject_prefix' and 'checkpatch' warnings --- drivers/net/tun.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 3d45d56172cb..2d9a00f41023 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -3071,9 +3071,13 @@ static long __tun_chr_ioctl(struct file *file, uns= igned int cmd, "Linktype set failed because interface is up\n"); ret =3D -EBUSY; } else { + call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, + tun->dev); tun->dev->type =3D (int) arg; netif_info(tun, drv, tun->dev, "linktype set to %d\n", tun->dev->type); + call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, + tun->dev); ret =3D 0; } break; --=20 2.20.1