]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv6/fib6_rules.c
Pull hotplug into release branch
[linux-2.6-omap-h63xx.git] / net / ipv6 / fib6_rules.c
index 53b3998a486ced67d9eae000cff6c9a1269ecf66..428c6b0e26d8e7238530e6b3d1c886f5c398af98 100644 (file)
@@ -31,27 +31,6 @@ struct fib6_rule
 
 static struct fib_rules_ops fib6_rules_ops;
 
-static struct fib6_rule main_rule = {
-       .common = {
-               .refcnt =       ATOMIC_INIT(2),
-               .pref =         0x7FFE,
-               .action =       FR_ACT_TO_TBL,
-               .table =        RT6_TABLE_MAIN,
-       },
-};
-
-static struct fib6_rule local_rule = {
-       .common = {
-               .refcnt =       ATOMIC_INIT(2),
-               .pref =         0,
-               .action =       FR_ACT_TO_TBL,
-               .table =        RT6_TABLE_LOCAL,
-               .flags =        FIB_RULE_PERMANENT,
-       },
-};
-
-static LIST_HEAD(fib6_rules);
-
 struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags,
                                   pol_lookup_t lookup)
 {
@@ -268,15 +247,27 @@ static struct fib_rules_ops fib6_rules_ops = {
        .nlmsg_payload          = fib6_rule_nlmsg_payload,
        .nlgroup                = RTNLGRP_IPV6_RULE,
        .policy                 = fib6_rule_policy,
-       .rules_list             = &fib6_rules,
+       .rules_list             = LIST_HEAD_INIT(fib6_rules_ops.rules_list),
        .owner                  = THIS_MODULE,
 };
 
-void __init fib6_rules_init(void)
+static int __init fib6_default_rules_init(void)
 {
-       list_add_tail(&local_rule.common.list, &fib6_rules);
-       list_add_tail(&main_rule.common.list, &fib6_rules);
+       int err;
+
+       err = fib_default_rule_add(&fib6_rules_ops, 0,
+                                  RT6_TABLE_LOCAL, FIB_RULE_PERMANENT);
+       if (err < 0)
+               return err;
+       err = fib_default_rule_add(&fib6_rules_ops, 0x7FFE, RT6_TABLE_MAIN, 0);
+       if (err < 0)
+               return err;
+       return 0;
+}
 
+void __init fib6_rules_init(void)
+{
+       BUG_ON(fib6_default_rules_init());
        fib_rules_register(&fib6_rules_ops);
 }