/*1* Network event notifiers2*3* Authors:4* Tom Tucker <[email protected]>5* Steve Wise <[email protected]>6*7* This program is free software; you can redistribute it and/or8* modify it under the terms of the GNU General Public License9* as published by the Free Software Foundation; either version10* 2 of the License, or (at your option) any later version.11*12* Fixes:13*/1415#include <linux/rtnetlink.h>16#include <linux/notifier.h>17#include <net/netevent.h>1819static ATOMIC_NOTIFIER_HEAD(netevent_notif_chain);2021/**22* register_netevent_notifier - register a netevent notifier block23* @nb: notifier24*25* Register a notifier to be called when a netevent occurs.26* The notifier passed is linked into the kernel structures and must27* not be reused until it has been unregistered. A negative errno code28* is returned on a failure.29*/30int register_netevent_notifier(struct notifier_block *nb)31{32int err;3334err = atomic_notifier_chain_register(&netevent_notif_chain, nb);35return err;36}37EXPORT_SYMBOL_GPL(register_netevent_notifier);3839/**40* netevent_unregister_notifier - unregister a netevent notifier block41* @nb: notifier42*43* Unregister a notifier previously registered by44* register_neigh_notifier(). The notifier is unlinked into the45* kernel structures and may then be reused. A negative errno code46* is returned on a failure.47*/4849int unregister_netevent_notifier(struct notifier_block *nb)50{51return atomic_notifier_chain_unregister(&netevent_notif_chain, nb);52}53EXPORT_SYMBOL_GPL(unregister_netevent_notifier);5455/**56* call_netevent_notifiers - call all netevent notifier blocks57* @val: value passed unmodified to notifier function58* @v: pointer passed unmodified to notifier function59*60* Call all neighbour notifier blocks. Parameters and return value61* are as for notifier_call_chain().62*/6364int call_netevent_notifiers(unsigned long val, void *v)65{66return atomic_notifier_call_chain(&netevent_notif_chain, val, v);67}68EXPORT_SYMBOL_GPL(call_netevent_notifiers);697071