18c2ecf20Sopenharmony_ci#ifndef __NET_FIB_NOTIFIER_H
28c2ecf20Sopenharmony_ci#define __NET_FIB_NOTIFIER_H
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#include <linux/types.h>
58c2ecf20Sopenharmony_ci#include <linux/notifier.h>
68c2ecf20Sopenharmony_ci#include <net/net_namespace.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cistruct module;
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistruct fib_notifier_info {
118c2ecf20Sopenharmony_ci	int family;
128c2ecf20Sopenharmony_ci	struct netlink_ext_ack  *extack;
138c2ecf20Sopenharmony_ci};
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cienum fib_event_type {
168c2ecf20Sopenharmony_ci	FIB_EVENT_ENTRY_REPLACE,
178c2ecf20Sopenharmony_ci	FIB_EVENT_ENTRY_APPEND,
188c2ecf20Sopenharmony_ci	FIB_EVENT_ENTRY_ADD,
198c2ecf20Sopenharmony_ci	FIB_EVENT_ENTRY_DEL,
208c2ecf20Sopenharmony_ci	FIB_EVENT_RULE_ADD,
218c2ecf20Sopenharmony_ci	FIB_EVENT_RULE_DEL,
228c2ecf20Sopenharmony_ci	FIB_EVENT_NH_ADD,
238c2ecf20Sopenharmony_ci	FIB_EVENT_NH_DEL,
248c2ecf20Sopenharmony_ci	FIB_EVENT_VIF_ADD,
258c2ecf20Sopenharmony_ci	FIB_EVENT_VIF_DEL,
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistruct fib_notifier_ops {
298c2ecf20Sopenharmony_ci	int family;
308c2ecf20Sopenharmony_ci	struct list_head list;
318c2ecf20Sopenharmony_ci	unsigned int (*fib_seq_read)(struct net *net);
328c2ecf20Sopenharmony_ci	int (*fib_dump)(struct net *net, struct notifier_block *nb,
338c2ecf20Sopenharmony_ci			struct netlink_ext_ack *extack);
348c2ecf20Sopenharmony_ci	struct module *owner;
358c2ecf20Sopenharmony_ci	struct rcu_head rcu;
368c2ecf20Sopenharmony_ci};
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciint call_fib_notifier(struct notifier_block *nb,
398c2ecf20Sopenharmony_ci		      enum fib_event_type event_type,
408c2ecf20Sopenharmony_ci		      struct fib_notifier_info *info);
418c2ecf20Sopenharmony_ciint call_fib_notifiers(struct net *net, enum fib_event_type event_type,
428c2ecf20Sopenharmony_ci		       struct fib_notifier_info *info);
438c2ecf20Sopenharmony_ciint register_fib_notifier(struct net *net, struct notifier_block *nb,
448c2ecf20Sopenharmony_ci			  void (*cb)(struct notifier_block *nb),
458c2ecf20Sopenharmony_ci			  struct netlink_ext_ack *extack);
468c2ecf20Sopenharmony_ciint unregister_fib_notifier(struct net *net, struct notifier_block *nb);
478c2ecf20Sopenharmony_cistruct fib_notifier_ops *
488c2ecf20Sopenharmony_cifib_notifier_ops_register(const struct fib_notifier_ops *tmpl, struct net *net);
498c2ecf20Sopenharmony_civoid fib_notifier_ops_unregister(struct fib_notifier_ops *ops);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#endif
52