lkml.org 
[lkml]   [2019]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/4] isdn/i4l: Call notifiers before and after changing device type
Date
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
---
drivers/isdn/i4l/isdn_net.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index c138f66f2659..3016cbcc719a 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -2692,8 +2692,12 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
p->dev->name);
return -EINVAL;
#else
+ rtnl_lock();
+ call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, p->dev);
p->dev->type = ARPHRD_PPP; /* change ARP type */
+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, p->dev);
p->dev->addr_len = 0;
+ rtnl_unlock();
#endif
break;
case ISDN_NET_ENCAP_X25IFACE:
@@ -2702,16 +2706,27 @@ isdn_net_setcfg(isdn_net_ioctl_cfg *cfg)
p->dev->name);
return -EINVAL;
#else
+ rtnl_lock();
+ call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, p->dev);
p->dev->type = ARPHRD_X25; /* change ARP type */
+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, p->dev);
p->dev->addr_len = 0;
+ rtnl_unlock();
#endif
break;
case ISDN_NET_ENCAP_CISCOHDLCK:
break;
default:
if (cfg->p_encap >= 0 &&
- cfg->p_encap <= ISDN_NET_ENCAP_MAX_ENCAP)
+ cfg->p_encap <= ISDN_NET_ENCAP_MAX_ENCAP) {
+ rtnl_lock();
+ call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, p->dev);
+ p->dev->type = ARPHRD_ETHER; /* change ARP type */
+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, p->dev);
+ p->dev->addr_len = ETH_ALEN;
+ rtnl_unlock();
break;
+ }
printk(KERN_WARNING
"%s: encapsulation protocol %d not supported\n",
p->dev->name, cfg->p_encap);
--
2.11.0
\
 
 \ /
  Last update: 2019-04-03 07:02    [W:0.177 / U:2.692 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site