162306a36Sopenharmony_ci#ifndef __NET_FIB_NOTIFIER_H
262306a36Sopenharmony_ci#define __NET_FIB_NOTIFIER_H
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#include <linux/types.h>
562306a36Sopenharmony_ci#include <linux/notifier.h>
662306a36Sopenharmony_ci#include <net/net_namespace.h>
762306a36Sopenharmony_ci
862306a36Sopenharmony_cistruct module;
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistruct fib_notifier_info {
1162306a36Sopenharmony_ci	int family;
1262306a36Sopenharmony_ci	struct netlink_ext_ack  *extack;
1362306a36Sopenharmony_ci};
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cienum fib_event_type {
1662306a36Sopenharmony_ci	FIB_EVENT_ENTRY_REPLACE,
1762306a36Sopenharmony_ci	FIB_EVENT_ENTRY_APPEND,
1862306a36Sopenharmony_ci	FIB_EVENT_ENTRY_ADD,
1962306a36Sopenharmony_ci	FIB_EVENT_ENTRY_DEL,
2062306a36Sopenharmony_ci	FIB_EVENT_RULE_ADD,
2162306a36Sopenharmony_ci	FIB_EVENT_RULE_DEL,
2262306a36Sopenharmony_ci	FIB_EVENT_NH_ADD,
2362306a36Sopenharmony_ci	FIB_EVENT_NH_DEL,
2462306a36Sopenharmony_ci	FIB_EVENT_VIF_ADD,
2562306a36Sopenharmony_ci	FIB_EVENT_VIF_DEL,
2662306a36Sopenharmony_ci};
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_cistruct fib_notifier_ops {
2962306a36Sopenharmony_ci	int family;
3062306a36Sopenharmony_ci	struct list_head list;
3162306a36Sopenharmony_ci	unsigned int (*fib_seq_read)(struct net *net);
3262306a36Sopenharmony_ci	int (*fib_dump)(struct net *net, struct notifier_block *nb,
3362306a36Sopenharmony_ci			struct netlink_ext_ack *extack);
3462306a36Sopenharmony_ci	struct module *owner;
3562306a36Sopenharmony_ci	struct rcu_head rcu;
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciint call_fib_notifier(struct notifier_block *nb,
3962306a36Sopenharmony_ci		      enum fib_event_type event_type,
4062306a36Sopenharmony_ci		      struct fib_notifier_info *info);
4162306a36Sopenharmony_ciint call_fib_notifiers(struct net *net, enum fib_event_type event_type,
4262306a36Sopenharmony_ci		       struct fib_notifier_info *info);
4362306a36Sopenharmony_ciint register_fib_notifier(struct net *net, struct notifier_block *nb,
4462306a36Sopenharmony_ci			  void (*cb)(struct notifier_block *nb),
4562306a36Sopenharmony_ci			  struct netlink_ext_ack *extack);
4662306a36Sopenharmony_ciint unregister_fib_notifier(struct net *net, struct notifier_block *nb);
4762306a36Sopenharmony_cistruct fib_notifier_ops *
4862306a36Sopenharmony_cifib_notifier_ops_register(const struct fib_notifier_ops *tmpl, struct net *net);
4962306a36Sopenharmony_civoid fib_notifier_ops_unregister(struct fib_notifier_ops *ops);
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#endif
52