fib_notifier.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef __NET_FIB_NOTIFIER_H
  2. #define __NET_FIB_NOTIFIER_H
  3. #include <linux/types.h>
  4. #include <linux/module.h>
  5. #include <linux/notifier.h>
  6. #include <net/net_namespace.h>
  7. struct fib_notifier_info {
  8. struct net *net;
  9. int family;
  10. struct netlink_ext_ack *extack;
  11. };
  12. enum fib_event_type {
  13. FIB_EVENT_ENTRY_REPLACE,
  14. FIB_EVENT_ENTRY_APPEND,
  15. FIB_EVENT_ENTRY_ADD,
  16. FIB_EVENT_ENTRY_DEL,
  17. FIB_EVENT_RULE_ADD,
  18. FIB_EVENT_RULE_DEL,
  19. FIB_EVENT_NH_ADD,
  20. FIB_EVENT_NH_DEL,
  21. FIB_EVENT_VIF_ADD,
  22. FIB_EVENT_VIF_DEL,
  23. };
  24. struct fib_notifier_ops {
  25. int family;
  26. struct list_head list;
  27. unsigned int (*fib_seq_read)(struct net *net);
  28. int (*fib_dump)(struct net *net, struct notifier_block *nb);
  29. struct module *owner;
  30. struct rcu_head rcu;
  31. };
  32. int call_fib_notifier(struct notifier_block *nb, struct net *net,
  33. enum fib_event_type event_type,
  34. struct fib_notifier_info *info);
  35. int call_fib_notifiers(struct net *net, enum fib_event_type event_type,
  36. struct fib_notifier_info *info);
  37. int register_fib_notifier(struct notifier_block *nb,
  38. void (*cb)(struct notifier_block *nb));
  39. int unregister_fib_notifier(struct notifier_block *nb);
  40. struct fib_notifier_ops *
  41. fib_notifier_ops_register(const struct fib_notifier_ops *tmpl, struct net *net);
  42. void fib_notifier_ops_unregister(struct fib_notifier_ops *ops);
  43. #endif