rtnetlink.c (3a931a80cb25f905da377d1bb0ba9b1641aa579a) rtnetlink.c (669f87baab90183e13b95480aecf8d7bac92ca3c)
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>

--- 255 unchanged lines hidden (view full) ---

264 rtnl_lock();
265 err = __rtnl_link_register(ops);
266 rtnl_unlock();
267 return err;
268}
269
270EXPORT_SYMBOL_GPL(rtnl_link_register);
271
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>

--- 255 unchanged lines hidden (view full) ---

264 rtnl_lock();
265 err = __rtnl_link_register(ops);
266 rtnl_unlock();
267 return err;
268}
269
270EXPORT_SYMBOL_GPL(rtnl_link_register);
271
272static void __rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops)
273{
274 struct net_device *dev;
275restart:
276 for_each_netdev(net, dev) {
277 if (dev->rtnl_link_ops == ops) {
278 ops->dellink(dev);
279 goto restart;
280 }
281 }
282}
283
284void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops)
285{
286 rtnl_lock();
287 __rtnl_kill_links(net, ops);
288 rtnl_unlock();
289}
290EXPORT_SYMBOL_GPL(rtnl_kill_links);
291
272/**
273 * __rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink.
274 * @ops: struct rtnl_link_ops * to unregister
275 *
276 * The caller must hold the rtnl_mutex.
277 */
278void __rtnl_link_unregister(struct rtnl_link_ops *ops)
279{
292/**
293 * __rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink.
294 * @ops: struct rtnl_link_ops * to unregister
295 *
296 * The caller must hold the rtnl_mutex.
297 */
298void __rtnl_link_unregister(struct rtnl_link_ops *ops)
299{
280 struct net_device *dev;
281 struct net *net;
282
283 for_each_net(net) {
300 struct net *net;
301
302 for_each_net(net) {
284restart:
285 for_each_netdev(net, dev) {
286 if (dev->rtnl_link_ops == ops) {
287 ops->dellink(dev);
288 goto restart;
289 }
290 }
303 __rtnl_kill_links(net, ops);
291 }
292 list_del(&ops->list);
293}
294
295EXPORT_SYMBOL_GPL(__rtnl_link_unregister);
296
297/**
298 * rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink.

--- 1098 unchanged lines hidden ---
304 }
305 list_del(&ops->list);
306}
307
308EXPORT_SYMBOL_GPL(__rtnl_link_unregister);
309
310/**
311 * rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink.

--- 1098 unchanged lines hidden ---