|
6 | 6 | #include <linux/spinlock.h> |
7 | 7 | #include <net/net_namespace.h> |
8 | 8 | #include <net/sock.h> |
| 9 | +#include <net/fib_notifier.h> |
9 | 10 |
|
10 | 11 | /** |
11 | 12 | * struct vif_device - interface representor for multicast routing |
@@ -36,6 +37,58 @@ struct vif_device { |
36 | 37 | __be32 local, remote; |
37 | 38 | }; |
38 | 39 |
|
| 40 | +struct vif_entry_notifier_info { |
| 41 | + struct fib_notifier_info info; |
| 42 | + struct net_device *dev; |
| 43 | + unsigned short vif_index; |
| 44 | + unsigned short vif_flags; |
| 45 | + u32 tb_id; |
| 46 | +}; |
| 47 | + |
| 48 | +static inline int mr_call_vif_notifier(struct notifier_block *nb, |
| 49 | + struct net *net, |
| 50 | + unsigned short family, |
| 51 | + enum fib_event_type event_type, |
| 52 | + struct vif_device *vif, |
| 53 | + unsigned short vif_index, u32 tb_id) |
| 54 | +{ |
| 55 | + struct vif_entry_notifier_info info = { |
| 56 | + .info = { |
| 57 | + .family = family, |
| 58 | + .net = net, |
| 59 | + }, |
| 60 | + .dev = vif->dev, |
| 61 | + .vif_index = vif_index, |
| 62 | + .vif_flags = vif->flags, |
| 63 | + .tb_id = tb_id, |
| 64 | + }; |
| 65 | + |
| 66 | + return call_fib_notifier(nb, net, event_type, &info.info); |
| 67 | +} |
| 68 | + |
| 69 | +static inline int mr_call_vif_notifiers(struct net *net, |
| 70 | + unsigned short family, |
| 71 | + enum fib_event_type event_type, |
| 72 | + struct vif_device *vif, |
| 73 | + unsigned short vif_index, u32 tb_id, |
| 74 | + unsigned int *ipmr_seq) |
| 75 | +{ |
| 76 | + struct vif_entry_notifier_info info = { |
| 77 | + .info = { |
| 78 | + .family = family, |
| 79 | + .net = net, |
| 80 | + }, |
| 81 | + .dev = vif->dev, |
| 82 | + .vif_index = vif_index, |
| 83 | + .vif_flags = vif->flags, |
| 84 | + .tb_id = tb_id, |
| 85 | + }; |
| 86 | + |
| 87 | + ASSERT_RTNL(); |
| 88 | + (*ipmr_seq)++; |
| 89 | + return call_fib_notifiers(net, event_type, &info.info); |
| 90 | +} |
| 91 | + |
39 | 92 | #ifndef MAXVIFS |
40 | 93 | /* This one is nasty; value is defined in uapi using different symbols for |
41 | 94 | * mroute and morute6 but both map into same 32. |
|
0 commit comments