diff options
-rw-r--r-- | include/net/fib_rules.h | 1 | ||||
-rw-r--r-- | include/net/ip6_fib.h | 2 | ||||
-rw-r--r-- | net/core/fib_rules.c | 5 | ||||
-rw-r--r-- | net/ipv6/fib6_rules.c | 19 |
4 files changed, 21 insertions, 6 deletions
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 41a301e38643..2364db1a47e6 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -103,6 +103,7 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | |||
103 | 103 | ||
104 | extern int fib_rules_register(struct fib_rules_ops *); | 104 | extern int fib_rules_register(struct fib_rules_ops *); |
105 | extern int fib_rules_unregister(struct fib_rules_ops *); | 105 | extern int fib_rules_unregister(struct fib_rules_ops *); |
106 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); | ||
106 | 107 | ||
107 | extern int fib_rules_lookup(struct fib_rules_ops *, | 108 | extern int fib_rules_lookup(struct fib_rules_ops *, |
108 | struct flowi *, int flags, | 109 | struct flowi *, int flags, |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 5d39ce92afcf..eaa315868792 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -226,7 +226,7 @@ extern void fib6_gc_cleanup(void); | |||
226 | 226 | ||
227 | extern int fib6_init(void); | 227 | extern int fib6_init(void); |
228 | 228 | ||
229 | extern void fib6_rules_init(void); | 229 | extern int fib6_rules_init(void); |
230 | extern void fib6_rules_cleanup(void); | 230 | extern void fib6_rules_cleanup(void); |
231 | 231 | ||
232 | #endif | 232 | #endif |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 0af0538343da..fcbf41c0a5d4 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -102,7 +102,7 @@ errout: | |||
102 | 102 | ||
103 | EXPORT_SYMBOL_GPL(fib_rules_register); | 103 | EXPORT_SYMBOL_GPL(fib_rules_register); |
104 | 104 | ||
105 | static void cleanup_ops(struct fib_rules_ops *ops) | 105 | void fib_rules_cleanup_ops(struct fib_rules_ops *ops) |
106 | { | 106 | { |
107 | struct fib_rule *rule, *tmp; | 107 | struct fib_rule *rule, *tmp; |
108 | 108 | ||
@@ -111,6 +111,7 @@ static void cleanup_ops(struct fib_rules_ops *ops) | |||
111 | fib_rule_put(rule); | 111 | fib_rule_put(rule); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(fib_rules_cleanup_ops); | ||
114 | 115 | ||
115 | int fib_rules_unregister(struct fib_rules_ops *ops) | 116 | int fib_rules_unregister(struct fib_rules_ops *ops) |
116 | { | 117 | { |
@@ -121,7 +122,7 @@ int fib_rules_unregister(struct fib_rules_ops *ops) | |||
121 | list_for_each_entry(o, &rules_ops, list) { | 122 | list_for_each_entry(o, &rules_ops, list) { |
122 | if (o == ops) { | 123 | if (o == ops) { |
123 | list_del_rcu(&o->list); | 124 | list_del_rcu(&o->list); |
124 | cleanup_ops(ops); | 125 | fib_rules_cleanup_ops(ops); |
125 | goto out; | 126 | goto out; |
126 | } | 127 | } |
127 | } | 128 | } |
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 428c6b0e26d8..9ce2e0a6748a 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -265,10 +265,23 @@ static int __init fib6_default_rules_init(void) | |||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
267 | 267 | ||
268 | void __init fib6_rules_init(void) | 268 | int __init fib6_rules_init(void) |
269 | { | 269 | { |
270 | BUG_ON(fib6_default_rules_init()); | 270 | int ret; |
271 | fib_rules_register(&fib6_rules_ops); | 271 | |
272 | ret = fib6_default_rules_init(); | ||
273 | if (ret) | ||
274 | goto out; | ||
275 | |||
276 | ret = fib_rules_register(&fib6_rules_ops); | ||
277 | if (ret) | ||
278 | goto out_default_rules_init; | ||
279 | out: | ||
280 | return ret; | ||
281 | |||
282 | out_default_rules_init: | ||
283 | fib_rules_cleanup_ops(&fib6_rules_ops); | ||
284 | goto out; | ||
272 | } | 285 | } |
273 | 286 | ||
274 | void fib6_rules_cleanup(void) | 287 | void fib6_rules_cleanup(void) |