// SPDX-License-Identifier: GPL-2.0-or-later1/*2* Network event notifiers3*4* Authors:5* Tom Tucker <[email protected]>6* Steve Wise <[email protected]>7*8* Fixes:9*/1011#include <linux/rtnetlink.h>12#include <linux/notifier.h>13#include <linux/export.h>14#include <net/netevent.h>1516static ATOMIC_NOTIFIER_HEAD(netevent_notif_chain);1718/**19* register_netevent_notifier - register a netevent notifier block20* @nb: notifier21*22* Register a notifier to be called when a netevent occurs.23* The notifier passed is linked into the kernel structures and must24* not be reused until it has been unregistered. A negative errno code25* is returned on a failure.26*/27int register_netevent_notifier(struct notifier_block *nb)28{29return atomic_notifier_chain_register(&netevent_notif_chain, nb);30}31EXPORT_SYMBOL_GPL(register_netevent_notifier);3233/**34* unregister_netevent_notifier - unregister a netevent notifier block35* @nb: notifier36*37* Unregister a notifier previously registered by38* register_neigh_notifier(). The notifier is unlinked into the39* kernel structures and may then be reused. A negative errno code40* is returned on a failure.41*/4243int unregister_netevent_notifier(struct notifier_block *nb)44{45return atomic_notifier_chain_unregister(&netevent_notif_chain, nb);46}47EXPORT_SYMBOL_GPL(unregister_netevent_notifier);4849/**50* call_netevent_notifiers - call all netevent notifier blocks51* @val: value passed unmodified to notifier function52* @v: pointer passed unmodified to notifier function53*54* Call all neighbour notifier blocks. Parameters and return value55* are as for notifier_call_chain().56*/5758int call_netevent_notifiers(unsigned long val, void *v)59{60return atomic_notifier_call_chain(&netevent_notif_chain, val, v);61}62EXPORT_SYMBOL_GPL(call_netevent_notifiers);636465