fib_notifier.h 1.3 KB
Newer Older
1 2 3 4 5 6 7
#ifndef __NET_FIB_NOTIFIER_H
#define __NET_FIB_NOTIFIER_H

#include <linux/types.h>
#include <linux/notifier.h>
#include <net/net_namespace.h>

8 9
struct module;

10 11
struct fib_notifier_info {
	int family;
D
David Ahern 已提交
12
	struct netlink_ext_ack  *extack;
13 14 15 16 17 18 19 20 21 22 23
};

enum fib_event_type {
	FIB_EVENT_ENTRY_REPLACE,
	FIB_EVENT_ENTRY_APPEND,
	FIB_EVENT_ENTRY_ADD,
	FIB_EVENT_ENTRY_DEL,
	FIB_EVENT_RULE_ADD,
	FIB_EVENT_RULE_DEL,
	FIB_EVENT_NH_ADD,
	FIB_EVENT_NH_DEL,
24 25
	FIB_EVENT_VIF_ADD,
	FIB_EVENT_VIF_DEL,
26 27 28 29 30 31 32
};

struct fib_notifier_ops {
	int family;
	struct list_head list;
	unsigned int (*fib_seq_read)(struct net *net);
	int (*fib_dump)(struct net *net, struct notifier_block *nb);
33
	struct module *owner;
34 35 36
	struct rcu_head rcu;
};

37
int call_fib_notifier(struct notifier_block *nb,
38 39 40 41
		      enum fib_event_type event_type,
		      struct fib_notifier_info *info);
int call_fib_notifiers(struct net *net, enum fib_event_type event_type,
		       struct fib_notifier_info *info);
42
int register_fib_notifier(struct net *net, struct notifier_block *nb,
43
			  void (*cb)(struct notifier_block *nb));
44
int unregister_fib_notifier(struct net *net, struct notifier_block *nb);
45 46 47 48 49
struct fib_notifier_ops *
fib_notifier_ops_register(const struct fib_notifier_ops *tmpl, struct net *net);
void fib_notifier_ops_unregister(struct fib_notifier_ops *ops);

#endif