fib6: install fib6 ops in the last step
[cascardo/linux.git] / net / ipv6 / fib6_rules.c
index b4d5e1d..273eb26 100644 (file)
@@ -104,6 +104,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp,
                                goto again;
                        flp6->saddr = saddr;
                }
+               err = rt->dst.error;
                goto out;
        }
 again:
@@ -298,19 +299,16 @@ static int __net_init fib6_rules_net_init(struct net *net)
        ops = fib_rules_register(&fib6_rules_ops_template, net);
        if (IS_ERR(ops))
                return PTR_ERR(ops);
-       net->ipv6.fib6_rules_ops = ops;
-
 
-       err = fib_default_rule_add(net->ipv6.fib6_rules_ops, 0,
-                                  RT6_TABLE_LOCAL, 0);
+       err = fib_default_rule_add(ops, 0, RT6_TABLE_LOCAL, 0);
        if (err)
                goto out_fib6_rules_ops;
 
-       err = fib_default_rule_add(net->ipv6.fib6_rules_ops,
-                                  0x7FFE, RT6_TABLE_MAIN, 0);
+       err = fib_default_rule_add(ops, 0x7FFE, RT6_TABLE_MAIN, 0);
        if (err)
                goto out_fib6_rules_ops;
 
+       net->ipv6.fib6_rules_ops = ops;
 out:
        return err;