Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp75553pxb; Tue, 17 Nov 2020 21:24:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9nXaLGVCo5HK9paHimUP5/53qMtHlY4+UoUgC6xfbsTfCQ0mnTGkVq7nH892l4eBO2GN+ X-Received: by 2002:aa7:c5c7:: with SMTP id h7mr326838eds.143.1605677065640; Tue, 17 Nov 2020 21:24:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605677065; cv=none; d=google.com; s=arc-20160816; b=tyETGET7opzPjlGgD6xMcZIxsrlp9C9Ux8Ka3lQi4JuYXYsnemJJlkn5kjH9YNQmo3 bD8QWhmvPMqDzeaZCoyHpA7x+zGihsU/wOAuJLFGX4vMkUBdUI5D7wZWNWLu6BlHImYa nV9cKwW+LDT1FxUraCs6ur1jRe9VjOVgLk3ssDd02PubwlEujXLlf6dCxOqWHanhIcCD Oketxzjneu7RF2b3gGRecINX+aQ5LQFv5cGAhWQjmxnmKpjq9KmXu7Bad8ktZbTDTbgm DbuuxKLzRetTyoOQsQton0jNILkF+IXnkSZdV94goF9vjXNFYiEyQSH/AFta/DPbK0IL /ESw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :organization:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=LjkTetijzMsJFd3Wi7l4bRJ3beYaFmBXGvDoqqK9UoA=; b=poTubH7V3krW0+Hh/K2ajL3kBOmYRcQeOwGGBPvA+smZZuwd0ReD1+5dCt7YGiCE9X kyeaEuiVtwEEPmNasMZsWG/QBrKpCkh2vNpWreWJr80JSDVkliSYwmIGJQ3++eWuDFhi dN39Vew2NQ3VeRk1bheHi1yW/8+/705GKQ0Cb+daQ51eofoMBfCdfZnyf3hnd8Hnp/vJ gnvt8WJMVMnEipnb+jf2yNjOD7/ZQ6S6Plumdw9JkI2eIEQAj9r7ule0l+UG8GgRLASQ iKgnfXmWBJ8nNps03lwTh6Ed45AC8NmWzfnATpuB6uxqf+wQv4w0FAnzkqCmn6rhfBwV Htyg== 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 v5si1404950ejj.588.2020.11.17.21.24.03; Tue, 17 Nov 2020 21:24:25 -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 S1726548AbgKRFWh (ORCPT + 99 others); Wed, 18 Nov 2020 00:22:37 -0500 Received: from mxout70.expurgate.net ([91.198.224.70]:10201 "EHLO mxout70.expurgate.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726256AbgKRFWh (ORCPT ); Wed, 18 Nov 2020 00:22:37 -0500 Received: from [127.0.0.1] (helo=localhost) by relay.expurgate.net with smtp (Exim 4.92) (envelope-from ) id 1kfFvM-000Pvy-Tr; Wed, 18 Nov 2020 06:22:32 +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 1kfFvM-000TPg-7R; Wed, 18 Nov 2020 06:22:32 +0100 Received: from securemail.tdt.de (localhost [127.0.0.1]) by securemail.tdt.de (Postfix) with ESMTP id E1322240041; Wed, 18 Nov 2020 06:22:31 +0100 (CET) Received: from mail.dev.tdt.de (unknown [10.2.4.42]) by securemail.tdt.de (Postfix) with ESMTP id 8009F240040; Wed, 18 Nov 2020 06:22:31 +0100 (CET) Received: from mail.dev.tdt.de (localhost [IPv6:::1]) by mail.dev.tdt.de (Postfix) with ESMTP id 25B0E204F6; Wed, 18 Nov 2020 06:22:31 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 18 Nov 2020 06:22:31 +0100 From: Martin Schiller To: Jakub Kicinski Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v3] net/tun: Call netdev notifiers Organization: TDT AG In-Reply-To: <20201117163245.4ff522ef@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> References: <20201116104121.20884-1-ms@dev.tdt.de> <20201117163245.4ff522ef@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> Message-ID: X-Sender: ms@dev.tdt.de User-Agent: Roundcube Webmail/1.3.15 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 X-purgate-type: clean X-purgate-ID: 151534::1605676952-000035B9-463974AD/0/0 X-purgate: clean Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-18 01:32, Jakub Kicinski wrote: > On Mon, 16 Nov 2020 11:41:21 +0100 Martin Schiller wrote: >> 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, >> unsigned int cmd, >> "Linktype set failed because interface is up\n"); >> ret = -EBUSY; >> } else { >> + call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, >> + tun->dev); > > This call may return an error (which has to be unpacked with > notifier_to_errno()). OK, I'll fix that and send a v3 patch. > >> tun->dev->type = (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 = 0; >> } >> break;