]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/decnet/dn_rules.c
[NET]: Make the loopback device per network namespace.
[linux-2.6-omap-h63xx.git] / net / decnet / dn_rules.c
index a7a7da9b35c393bd43bd3c367e6de1f480e4a8e0..ddd3f04f0919ee880dba236ee1516df96d3a6bee 100644 (file)
@@ -31,6 +31,7 @@
 #include <net/dn_fib.h>
 #include <net/dn_neigh.h>
 #include <net/dn_dev.h>
+#include <net/dn_route.h>
 
 static struct fib_rules_ops dn_fib_rules_ops;
 
@@ -56,8 +57,6 @@ static struct dn_fib_rule default_rule = {
        },
 };
 
-static LIST_HEAD(dn_fib_rules);
-
 
 int dn_fib_lookup(struct flowi *flp, struct dn_fib_res *res)
 {
@@ -107,7 +106,7 @@ errout:
        return err;
 }
 
-static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
+static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = {
        FRA_GENERIC_POLICY,
 };
 
@@ -227,9 +226,9 @@ static u32 dn_fib_rule_default_pref(void)
        struct list_head *pos;
        struct fib_rule *rule;
 
-       if (!list_empty(&dn_fib_rules)) {
-               pos = dn_fib_rules.next;
-               if (pos->next != &dn_fib_rules) {
+       if (!list_empty(&dn_fib_rules_ops.rules_list)) {
+               pos = dn_fib_rules_ops.rules_list.next;
+               if (pos->next != &dn_fib_rules_ops.rules_list) {
                        rule = list_entry(pos->next, struct fib_rule, list);
                        if (rule->pref)
                                return rule->pref - 1;
@@ -239,9 +238,9 @@ static u32 dn_fib_rule_default_pref(void)
        return 0;
 }
 
-static int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb)
+static void dn_fib_rule_flush_cache(void)
 {
-       return fib_rules_dump(skb, cb, AF_DECnet);
+       dn_rt_cache_flush(-1);
 }
 
 static struct fib_rules_ops dn_fib_rules_ops = {
@@ -254,22 +253,22 @@ static struct fib_rules_ops dn_fib_rules_ops = {
        .compare        = dn_fib_rule_compare,
        .fill           = dn_fib_rule_fill,
        .default_pref   = dn_fib_rule_default_pref,
+       .flush_cache    = dn_fib_rule_flush_cache,
        .nlgroup        = RTNLGRP_DECnet_RULE,
        .policy         = dn_fib_rule_policy,
-       .rules_list     = &dn_fib_rules,
+       .rules_list     = LIST_HEAD_INIT(dn_fib_rules_ops.rules_list),
        .owner          = THIS_MODULE,
 };
 
 void __init dn_fib_rules_init(void)
 {
-       list_add_tail(&default_rule.common.list, &dn_fib_rules);
+       list_add_tail(&default_rule.common.list,
+                       &dn_fib_rules_ops.rules_list);
        fib_rules_register(&dn_fib_rules_ops);
-       rtnl_register(PF_DECnet, RTM_GETRULE, NULL, dn_fib_dump_rules);
 }
 
 void __exit dn_fib_rules_cleanup(void)
 {
-       rtnl_unregister(PF_DECnet, RTM_GETRULE);
        fib_rules_unregister(&dn_fib_rules_ops);
 }