Message ID | 20201116104121.20884-1-ms@dev.tdt.de (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v3] net/tun: Call netdev notifiers | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 13 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
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;
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;
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;
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(+)