mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-24 10:28:57 +00:00
864150dfa3
When a listener registers to the FIB notification chain it receives a
dump of the FIB entries and rules from existing address families by
invoking their dump operations.
While we call into these modules we need to make sure they aren't
removed. Do that by increasing their reference count before invoking
their dump operations and decrease it afterwards.
Fixes: 04b1d4e50e
("net: core: Make the FIB notification chain generic")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
#ifndef __NET_FIB_NOTIFIER_H
|
|
#define __NET_FIB_NOTIFIER_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/module.h>
|
|
#include <linux/notifier.h>
|
|
#include <net/net_namespace.h>
|
|
|
|
struct fib_notifier_info {
|
|
struct net *net;
|
|
int family;
|
|
};
|
|
|
|
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,
|
|
};
|
|
|
|
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);
|
|
struct module *owner;
|
|
struct rcu_head rcu;
|
|
};
|
|
|
|
int call_fib_notifier(struct notifier_block *nb, struct net *net,
|
|
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);
|
|
int register_fib_notifier(struct notifier_block *nb,
|
|
void (*cb)(struct notifier_block *nb));
|
|
int unregister_fib_notifier(struct notifier_block *nb);
|
|
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
|