aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2007-03-26 02:20:05 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:27:07 -0400
commit9d9e6a5819230b5a5cc036f213135cb123ab1e50 (patch)
treee158bb0b82bdc88de053e09dd5f1897eae8536f3
parentc8822a4e00442e65d42d50db8e529d75c2025630 (diff)
[NET] rules: Use rtnl registration interface
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/fib_rules.h6
-rw-r--r--net/core/fib_rules.c8
-rw-r--r--net/core/rtnetlink.c5
3 files changed, 7 insertions, 12 deletions
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index d585ea9fa97d..b2b9ccdf32d6 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -5,7 +5,7 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/fib_rules.h> 6#include <linux/fib_rules.h>
7#include <net/flow.h> 7#include <net/flow.h>
8#include <net/netlink.h> 8#include <net/rtnetlink.h>
9 9
10struct fib_rule 10struct fib_rule
11{ 11{
@@ -99,10 +99,6 @@ extern int fib_rules_lookup(struct fib_rules_ops *,
99 struct flowi *, int flags, 99 struct flowi *, int flags,
100 struct fib_lookup_arg *); 100 struct fib_lookup_arg *);
101 101
102extern int fib_nl_newrule(struct sk_buff *,
103 struct nlmsghdr *, void *);
104extern int fib_nl_delrule(struct sk_buff *,
105 struct nlmsghdr *, void *);
106extern int fib_rules_dump(struct sk_buff *, 102extern int fib_rules_dump(struct sk_buff *,
107 struct netlink_callback *, int); 103 struct netlink_callback *, int);
108#endif 104#endif
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 7174ced75efc..bf45f24cfea2 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -174,7 +174,7 @@ errout:
174 return err; 174 return err;
175} 175}
176 176
177int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 177static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
178{ 178{
179 struct fib_rule_hdr *frh = nlmsg_data(nlh); 179 struct fib_rule_hdr *frh = nlmsg_data(nlh);
180 struct fib_rules_ops *ops = NULL; 180 struct fib_rules_ops *ops = NULL;
@@ -265,7 +265,7 @@ errout:
265 return err; 265 return err;
266} 266}
267 267
268int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 268static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
269{ 269{
270 struct fib_rule_hdr *frh = nlmsg_data(nlh); 270 struct fib_rule_hdr *frh = nlmsg_data(nlh);
271 struct fib_rules_ops *ops = NULL; 271 struct fib_rules_ops *ops = NULL;
@@ -501,6 +501,10 @@ static struct notifier_block fib_rules_notifier = {
501 501
502static int __init fib_rules_init(void) 502static int __init fib_rules_init(void)
503{ 503{
504 rtnl_register(PF_UNSPEC, RTM_NEWRULE, fib_nl_newrule, NULL);
505 rtnl_register(PF_UNSPEC, RTM_DELRULE, fib_nl_delrule, NULL);
506 rtnl_register(PF_UNSPEC, RTM_GETRULE, NULL, rtnl_dump_all);
507
504 return register_netdevice_notifier(&fib_rules_notifier); 508 return register_netdevice_notifier(&fib_rules_notifier);
505} 509}
506 510
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 3044702f7d9b..5cc09f82f6d6 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -963,11 +963,6 @@ static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] =
963{ 963{
964 [RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all }, 964 [RTM_GETADDR - RTM_BASE] = { .dumpit = rtnl_dump_all },
965 [RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all }, 965 [RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnl_dump_all },
966#ifdef CONFIG_FIB_RULES
967 [RTM_NEWRULE - RTM_BASE] = { .doit = fib_nl_newrule },
968 [RTM_DELRULE - RTM_BASE] = { .doit = fib_nl_delrule },
969#endif
970 [RTM_GETRULE - RTM_BASE] = { .dumpit = rtnl_dump_all },
971}; 966};
972 967
973static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr) 968static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr)