Commit 8e1e33ff authored by Martin Schiller's avatar Martin Schiller Committed by Jakub Kicinski

net/tun: Call type change netdev notifiers

Call netdev notifiers before and after changing the device type.
Signed-off-by: default avatarMartin Schiller <ms@dev.tdt.de>
Link: https://lore.kernel.org/r/20201118063919.29485-1-ms@dev.tdt.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f9e425e9
......@@ -3071,10 +3071,19 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
"Linktype set failed because interface is up\n");
ret = -EBUSY;
} else {
ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE,
tun->dev);
ret = notifier_to_errno(ret);
if (ret) {
netif_info(tun, drv, tun->dev,
"Refused to change device type\n");
break;
}
tun->dev->type = (int) arg;
netif_info(tun, drv, tun->dev, "linktype set to %d\n",
tun->dev->type);
ret = 0;
call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE,
tun->dev);
}
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment