summaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_rules.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2016-09-26 12:52:29 +0200
committerDavid S. Miller <davem@davemloft.net>2016-09-28 10:48:00 +0200
commitb90eb754949931b2e4481b1df9a03f84d4be66ba (patch)
tree1866705c1e0a640e7498566173468e185d0813be /net/ipv4/fib_rules.c
parentnet/sched: cls_flower: Use a proper mask value for enc key id parameter (diff)
downloadlinux-b90eb754949931b2e4481b1df9a03f84d4be66ba.tar.xz
linux-b90eb754949931b2e4481b1df9a03f84d4be66ba.zip
fib: introduce FIB notification infrastructure
This allows to pass information about added/deleted FIB entries/rules to whoever is interested. This is done in a very similar way as devinet notifies address additions/removals. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_rules.c')
-rw-r--r--net/ipv4/fib_rules.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 770bebed6b28..ebadf6b99499 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -164,6 +164,14 @@ static struct fib_table *fib_empty_table(struct net *net)
return NULL;
}
+static int call_fib_rule_notifiers(struct net *net,
+ enum fib_event_type event_type)
+{
+ struct fib_notifier_info info;
+
+ return call_fib_notifiers(net, event_type, &info);
+}
+
static const struct nla_policy fib4_rule_policy[FRA_MAX+1] = {
FRA_GENERIC_POLICY,
[FRA_FLOW] = { .type = NLA_U32 },
@@ -221,6 +229,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
net->ipv4.fib_has_custom_rules = true;
fib_flush_external(rule->fr_net);
+ call_fib_rule_notifiers(net, FIB_EVENT_RULE_ADD);
err = 0;
errout:
@@ -243,6 +252,7 @@ static int fib4_rule_delete(struct fib_rule *rule)
#endif
net->ipv4.fib_has_custom_rules = true;
fib_flush_external(rule->fr_net);
+ call_fib_rule_notifiers(net, FIB_EVENT_RULE_DEL);
errout:
return err;
}