* [PATCH net-next v3] net/tun: Call netdev notifiers
@ 2020-11-16 10:41 Martin Schiller
2020-11-18 0:32 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Martin Schiller @ 2020-11-16 10:41 UTC (permalink / raw)
To: davem, kuba; +Cc: netdev, linux-kernel, Martin Schiller
Call netdev notifiers before and after changing the device type.
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
---
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);
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;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] net/tun: Call netdev notifiers
2020-11-16 10:41 [PATCH net-next v3] net/tun: Call netdev notifiers Martin Schiller
@ 2020-11-18 0:32 ` Jakub Kicinski
2020-11-18 5:22 ` Martin Schiller
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-18 0:32 UTC (permalink / raw)
To: Martin Schiller; +Cc: davem, netdev, linux-kernel
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 <ms@dev.tdt.de>
> ---
>
> 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()).
> 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] net/tun: Call netdev notifiers
2020-11-18 0:32 ` Jakub Kicinski
@ 2020-11-18 5:22 ` Martin Schiller
0 siblings, 0 replies; 3+ messages in thread
From: Martin Schiller @ 2020-11-18 5:22 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: davem, netdev, linux-kernel
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 <ms@dev.tdt.de>
>> ---
>>
>> 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-18 5:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 10:41 [PATCH net-next v3] net/tun: Call netdev notifiers Martin Schiller
2020-11-18 0:32 ` Jakub Kicinski
2020-11-18 5:22 ` Martin Schiller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).