rtnetlink.c (7c28bd0b8ec4d128bd7660671d1b626b0abc471f) | rtnetlink.c (23289a37e2b127dfc4de1313fba15bb4c9f0cd5b) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 234 unchanged lines hidden (view full) --- 243 * by drivers that create devices during module initialization. It 244 * must be called before registering the devices. 245 * 246 * Returns 0 on success or a negative error code. 247 */ 248int __rtnl_link_register(struct rtnl_link_ops *ops) 249{ 250 if (!ops->dellink) | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 234 unchanged lines hidden (view full) --- 243 * by drivers that create devices during module initialization. It 244 * must be called before registering the devices. 245 * 246 * Returns 0 on success or a negative error code. 247 */ 248int __rtnl_link_register(struct rtnl_link_ops *ops) 249{ 250 if (!ops->dellink) |
251 ops->dellink = unregister_netdevice; | 251 ops->dellink = unregister_netdevice_queue; |
252 253 list_add_tail(&ops->list, &link_ops); 254 return 0; 255} 256 257EXPORT_SYMBOL_GPL(__rtnl_link_register); 258 259/** --- 12 unchanged lines hidden (view full) --- 272 return err; 273} 274 275EXPORT_SYMBOL_GPL(rtnl_link_register); 276 277static void __rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops) 278{ 279 struct net_device *dev; | 252 253 list_add_tail(&ops->list, &link_ops); 254 return 0; 255} 256 257EXPORT_SYMBOL_GPL(__rtnl_link_register); 258 259/** --- 12 unchanged lines hidden (view full) --- 272 return err; 273} 274 275EXPORT_SYMBOL_GPL(rtnl_link_register); 276 277static void __rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops) 278{ 279 struct net_device *dev; |
280restart: | 280 LIST_HEAD(list_kill); 281 |
281 for_each_netdev(net, dev) { | 282 for_each_netdev(net, dev) { |
282 if (dev->rtnl_link_ops == ops) { 283 ops->dellink(dev); 284 goto restart; 285 } | 283 if (dev->rtnl_link_ops == ops) 284 ops->dellink(dev, &list_kill); |
286 } | 285 } |
286 unregister_netdevice_many(&list_kill); |
|
287} 288 289void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops) 290{ 291 rtnl_lock(); 292 __rtnl_kill_links(net, ops); 293 rtnl_unlock(); 294} --- 672 unchanged lines hidden (view full) --- 967 968 if (!dev) 969 return -ENODEV; 970 971 ops = dev->rtnl_link_ops; 972 if (!ops) 973 return -EOPNOTSUPP; 974 | 287} 288 289void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops) 290{ 291 rtnl_lock(); 292 __rtnl_kill_links(net, ops); 293 rtnl_unlock(); 294} --- 672 unchanged lines hidden (view full) --- 967 968 if (!dev) 969 return -ENODEV; 970 971 ops = dev->rtnl_link_ops; 972 if (!ops) 973 return -EOPNOTSUPP; 974 |
975 ops->dellink(dev); | 975 ops->dellink(dev, NULL); |
976 return 0; 977} 978 979struct net_device *rtnl_create_link(struct net *net, char *ifname, 980 const struct rtnl_link_ops *ops, struct nlattr *tb[]) 981{ 982 int err; 983 struct net_device *dev; --- 446 unchanged lines hidden --- | 976 return 0; 977} 978 979struct net_device *rtnl_create_link(struct net *net, char *ifname, 980 const struct rtnl_link_ops *ops, struct nlattr *tb[]) 981{ 982 int err; 983 struct net_device *dev; --- 446 unchanged lines hidden --- |