diff options
Diffstat (limited to 'net/ipv6/fib6_rules.c')
| -rw-r--r-- | net/ipv6/fib6_rules.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 706622af206f..428c6b0e26d8 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
| @@ -31,25 +31,6 @@ struct fib6_rule | |||
| 31 | 31 | ||
| 32 | static struct fib_rules_ops fib6_rules_ops; | 32 | static struct fib_rules_ops fib6_rules_ops; |
| 33 | 33 | ||
| 34 | static struct fib6_rule main_rule = { | ||
| 35 | .common = { | ||
| 36 | .refcnt = ATOMIC_INIT(2), | ||
| 37 | .pref = 0x7FFE, | ||
| 38 | .action = FR_ACT_TO_TBL, | ||
| 39 | .table = RT6_TABLE_MAIN, | ||
| 40 | }, | ||
| 41 | }; | ||
| 42 | |||
| 43 | static struct fib6_rule local_rule = { | ||
| 44 | .common = { | ||
| 45 | .refcnt = ATOMIC_INIT(2), | ||
| 46 | .pref = 0, | ||
| 47 | .action = FR_ACT_TO_TBL, | ||
| 48 | .table = RT6_TABLE_LOCAL, | ||
| 49 | .flags = FIB_RULE_PERMANENT, | ||
| 50 | }, | ||
| 51 | }; | ||
| 52 | |||
| 53 | struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, | 34 | struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, |
| 54 | pol_lookup_t lookup) | 35 | pol_lookup_t lookup) |
| 55 | { | 36 | { |
| @@ -270,11 +251,23 @@ static struct fib_rules_ops fib6_rules_ops = { | |||
| 270 | .owner = THIS_MODULE, | 251 | .owner = THIS_MODULE, |
| 271 | }; | 252 | }; |
| 272 | 253 | ||
| 273 | void __init fib6_rules_init(void) | 254 | static int __init fib6_default_rules_init(void) |
| 274 | { | 255 | { |
| 275 | list_add_tail(&local_rule.common.list, &fib6_rules_ops.rules_list); | 256 | int err; |
| 276 | list_add_tail(&main_rule.common.list, &fib6_rules_ops.rules_list); | 257 | |
| 258 | err = fib_default_rule_add(&fib6_rules_ops, 0, | ||
| 259 | RT6_TABLE_LOCAL, FIB_RULE_PERMANENT); | ||
| 260 | if (err < 0) | ||
| 261 | return err; | ||
| 262 | err = fib_default_rule_add(&fib6_rules_ops, 0x7FFE, RT6_TABLE_MAIN, 0); | ||
| 263 | if (err < 0) | ||
| 264 | return err; | ||
| 265 | return 0; | ||
| 266 | } | ||
| 277 | 267 | ||
| 268 | void __init fib6_rules_init(void) | ||
| 269 | { | ||
| 270 | BUG_ON(fib6_default_rules_init()); | ||
| 278 | fib_rules_register(&fib6_rules_ops); | 271 | fib_rules_register(&fib6_rules_ops); |
| 279 | } | 272 | } |
| 280 | 273 | ||
