diff options
-rw-r--r-- | include/linux/rtnetlink.h | 2 | ||||
-rw-r--r-- | include/net/ip6_fib.h | 9 | ||||
-rw-r--r-- | include/net/ip6_route.h | 5 | ||||
-rw-r--r-- | net/ipv6/Kconfig | 1 | ||||
-rw-r--r-- | net/ipv6/Makefile | 1 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 1 | ||||
-rw-r--r-- | net/ipv6/fib6_rules.c | 251 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 21 | ||||
-rw-r--r-- | net/ipv6/route.c | 50 |
9 files changed, 329 insertions, 12 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index facd9ee37b76..bf353538ae93 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -889,6 +889,8 @@ enum rtnetlink_groups { | |||
889 | RTNLGRP_NOP4, | 889 | RTNLGRP_NOP4, |
890 | RTNLGRP_IPV6_PREFIX, | 890 | RTNLGRP_IPV6_PREFIX, |
891 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX | 891 | #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX |
892 | RTNLGRP_IPV6_RULE, | ||
893 | #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE | ||
892 | __RTNLGRP_MAX | 894 | __RTNLGRP_MAX |
893 | }; | 895 | }; |
894 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) | 896 | #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 818411519c89..7b47e8d5a765 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -155,7 +155,6 @@ struct fib6_table { | |||
155 | 155 | ||
156 | #define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC | 156 | #define RT6_TABLE_UNSPEC RT_TABLE_UNSPEC |
157 | #define RT6_TABLE_MAIN RT_TABLE_MAIN | 157 | #define RT6_TABLE_MAIN RT_TABLE_MAIN |
158 | #define RT6_TABLE_LOCAL RT6_TABLE_MAIN | ||
159 | #define RT6_TABLE_DFLT RT6_TABLE_MAIN | 158 | #define RT6_TABLE_DFLT RT6_TABLE_MAIN |
160 | #define RT6_TABLE_INFO RT6_TABLE_MAIN | 159 | #define RT6_TABLE_INFO RT6_TABLE_MAIN |
161 | #define RT6_TABLE_PREFIX RT6_TABLE_MAIN | 160 | #define RT6_TABLE_PREFIX RT6_TABLE_MAIN |
@@ -163,9 +162,11 @@ struct fib6_table { | |||
163 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 162 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
164 | #define FIB6_TABLE_MIN 1 | 163 | #define FIB6_TABLE_MIN 1 |
165 | #define FIB6_TABLE_MAX RT_TABLE_MAX | 164 | #define FIB6_TABLE_MAX RT_TABLE_MAX |
165 | #define RT6_TABLE_LOCAL RT_TABLE_LOCAL | ||
166 | #else | 166 | #else |
167 | #define FIB6_TABLE_MIN RT_TABLE_MAIN | 167 | #define FIB6_TABLE_MIN RT_TABLE_MAIN |
168 | #define FIB6_TABLE_MAX FIB6_TABLE_MIN | 168 | #define FIB6_TABLE_MAX FIB6_TABLE_MIN |
169 | #define RT6_TABLE_LOCAL RT6_TABLE_MAIN | ||
169 | #endif | 170 | #endif |
170 | 171 | ||
171 | #define RT6_F_STRICT 1 | 172 | #define RT6_F_STRICT 1 |
@@ -221,5 +222,11 @@ extern void fib6_run_gc(unsigned long dummy); | |||
221 | extern void fib6_gc_cleanup(void); | 222 | extern void fib6_gc_cleanup(void); |
222 | 223 | ||
223 | extern void fib6_init(void); | 224 | extern void fib6_init(void); |
225 | |||
226 | extern void fib6_rules_init(void); | ||
227 | extern void fib6_rules_cleanup(void); | ||
228 | extern int fib6_rules_dump(struct sk_buff *, | ||
229 | struct netlink_callback *); | ||
230 | |||
224 | #endif | 231 | #endif |
225 | #endif | 232 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index d49c8c90eb68..9bfa3cc6cedb 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -41,6 +41,11 @@ struct pol_chain { | |||
41 | 41 | ||
42 | extern struct rt6_info ip6_null_entry; | 42 | extern struct rt6_info ip6_null_entry; |
43 | 43 | ||
44 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
45 | extern struct rt6_info ip6_prohibit_entry; | ||
46 | extern struct rt6_info ip6_blk_hole_entry; | ||
47 | #endif | ||
48 | |||
44 | extern int ip6_rt_gc_interval; | 49 | extern int ip6_rt_gc_interval; |
45 | 50 | ||
46 | extern void ip6_route_input(struct sk_buff *skb); | 51 | extern void ip6_route_input(struct sk_buff *skb); |
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index 159c63d99c81..36a6c2b79889 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
@@ -139,6 +139,7 @@ config IPV6_TUNNEL | |||
139 | config IPV6_MULTIPLE_TABLES | 139 | config IPV6_MULTIPLE_TABLES |
140 | bool "IPv6: Multiple Routing Tables" | 140 | bool "IPv6: Multiple Routing Tables" |
141 | depends on IPV6 && EXPERIMENTAL | 141 | depends on IPV6 && EXPERIMENTAL |
142 | select FIB_RULES | ||
142 | ---help--- | 143 | ---help--- |
143 | Support multiple routing tables. | 144 | Support multiple routing tables. |
144 | 145 | ||
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index 386e0a626948..9eebf6091279 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile | |||
@@ -13,6 +13,7 @@ ipv6-objs := af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o sit.o \ | |||
13 | ipv6-$(CONFIG_XFRM) += xfrm6_policy.o xfrm6_state.o xfrm6_input.o \ | 13 | ipv6-$(CONFIG_XFRM) += xfrm6_policy.o xfrm6_state.o xfrm6_input.o \ |
14 | xfrm6_output.o | 14 | xfrm6_output.o |
15 | ipv6-$(CONFIG_NETFILTER) += netfilter.o | 15 | ipv6-$(CONFIG_NETFILTER) += netfilter.o |
16 | ipv6-$(CONFIG_IPV6_MULTIPLE_TABLES) += fib6_rules.o | ||
16 | ipv6-objs += $(ipv6-y) | 17 | ipv6-objs += $(ipv6-y) |
17 | 18 | ||
18 | obj-$(CONFIG_INET6_AH) += ah6.o | 19 | obj-$(CONFIG_INET6_AH) += ah6.o |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 318767fcefdc..ed766eebc022 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3528,6 +3528,7 @@ static struct rtnetlink_link inet6_rtnetlink_table[RTM_NR_MSGTYPES] = { | |||
3528 | [RTM_DELROUTE - RTM_BASE] = { .doit = inet6_rtm_delroute, }, | 3528 | [RTM_DELROUTE - RTM_BASE] = { .doit = inet6_rtm_delroute, }, |
3529 | [RTM_GETROUTE - RTM_BASE] = { .doit = inet6_rtm_getroute, | 3529 | [RTM_GETROUTE - RTM_BASE] = { .doit = inet6_rtm_getroute, |
3530 | .dumpit = inet6_dump_fib, }, | 3530 | .dumpit = inet6_dump_fib, }, |
3531 | [RTM_GETRULE - RTM_BASE] = { .dumpit = fib6_rules_dump, }, | ||
3531 | }; | 3532 | }; |
3532 | 3533 | ||
3533 | static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) | 3534 | static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) |
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c new file mode 100644 index 000000000000..c3c8195744ee --- /dev/null +++ b/net/ipv6/fib6_rules.c | |||
@@ -0,0 +1,251 @@ | |||
1 | /* | ||
2 | * net/ipv6/fib6_rules.c IPv6 Routing Policy Rules | ||
3 | * | ||
4 | * Copyright (C)2003-2006 Helsinki University of Technology | ||
5 | * Copyright (C)2003-2006 USAGI/WIDE Project | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License as | ||
9 | * published by the Free Software Foundation, version 2. | ||
10 | * | ||
11 | * Authors | ||
12 | * Thomas Graf <tgraf@suug.ch> | ||
13 | * Ville Nuorvala <vnuorval@tcs.hut.fi> | ||
14 | */ | ||
15 | |||
16 | #include <linux/config.h> | ||
17 | #include <linux/netdevice.h> | ||
18 | |||
19 | #include <net/fib_rules.h> | ||
20 | #include <net/ipv6.h> | ||
21 | #include <net/ip6_route.h> | ||
22 | #include <net/netlink.h> | ||
23 | |||
24 | struct fib6_rule | ||
25 | { | ||
26 | struct fib_rule common; | ||
27 | struct rt6key src; | ||
28 | struct rt6key dst; | ||
29 | u8 tclass; | ||
30 | }; | ||
31 | |||
32 | static struct fib_rules_ops fib6_rules_ops; | ||
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 | static LIST_HEAD(fib6_rules); | ||
54 | |||
55 | struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, | ||
56 | pol_lookup_t lookup) | ||
57 | { | ||
58 | struct fib_lookup_arg arg = { | ||
59 | .lookup_ptr = lookup, | ||
60 | }; | ||
61 | |||
62 | fib_rules_lookup(&fib6_rules_ops, fl, flags, &arg); | ||
63 | if (arg.rule) | ||
64 | fib_rule_put(arg.rule); | ||
65 | |||
66 | return (struct dst_entry *) arg.result; | ||
67 | } | ||
68 | |||
69 | int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | ||
70 | int flags, struct fib_lookup_arg *arg) | ||
71 | { | ||
72 | struct rt6_info *rt = NULL; | ||
73 | struct fib6_table *table; | ||
74 | pol_lookup_t lookup = arg->lookup_ptr; | ||
75 | |||
76 | switch (rule->action) { | ||
77 | case FR_ACT_TO_TBL: | ||
78 | break; | ||
79 | case FR_ACT_UNREACHABLE: | ||
80 | rt = &ip6_null_entry; | ||
81 | goto discard_pkt; | ||
82 | default: | ||
83 | case FR_ACT_BLACKHOLE: | ||
84 | rt = &ip6_blk_hole_entry; | ||
85 | goto discard_pkt; | ||
86 | case FR_ACT_PROHIBIT: | ||
87 | rt = &ip6_prohibit_entry; | ||
88 | goto discard_pkt; | ||
89 | } | ||
90 | |||
91 | table = fib6_get_table(rule->table); | ||
92 | if (table) | ||
93 | rt = lookup(table, flp, flags); | ||
94 | |||
95 | if (rt != &ip6_null_entry) | ||
96 | goto out; | ||
97 | |||
98 | dst_release(&rt->u.dst); | ||
99 | discard_pkt: | ||
100 | dst_hold(&rt->u.dst); | ||
101 | out: | ||
102 | arg->result = rt; | ||
103 | return rt == NULL ? -EAGAIN : 0; | ||
104 | } | ||
105 | |||
106 | |||
107 | static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) | ||
108 | { | ||
109 | struct fib6_rule *r = (struct fib6_rule *) rule; | ||
110 | |||
111 | if (!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen)) | ||
112 | return 0; | ||
113 | |||
114 | if ((flags & RT6_F_HAS_SADDR) && | ||
115 | !ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen)) | ||
116 | return 0; | ||
117 | |||
118 | return 1; | ||
119 | } | ||
120 | |||
121 | static struct nla_policy fib6_rule_policy[RTA_MAX+1] __read_mostly = { | ||
122 | [FRA_IFNAME] = { .type = NLA_STRING }, | ||
123 | [FRA_PRIORITY] = { .type = NLA_U32 }, | ||
124 | [FRA_SRC] = { .minlen = sizeof(struct in6_addr) }, | ||
125 | [FRA_DST] = { .minlen = sizeof(struct in6_addr) }, | ||
126 | }; | ||
127 | |||
128 | static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | ||
129 | struct nlmsghdr *nlh, struct fib_rule_hdr *frh, | ||
130 | struct nlattr **tb) | ||
131 | { | ||
132 | int err = -EINVAL; | ||
133 | struct fib6_rule *rule6 = (struct fib6_rule *) rule; | ||
134 | |||
135 | if (frh->src_len > 128 || frh->dst_len > 128 || | ||
136 | (frh->tos & ~IPV6_FLOWINFO_MASK)) | ||
137 | goto errout; | ||
138 | |||
139 | if (rule->action == FR_ACT_TO_TBL) { | ||
140 | if (rule->table == RT6_TABLE_UNSPEC) | ||
141 | goto errout; | ||
142 | |||
143 | if (fib6_new_table(rule->table) == NULL) { | ||
144 | err = -ENOBUFS; | ||
145 | goto errout; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | if (tb[FRA_SRC]) | ||
150 | nla_memcpy(&rule6->src.addr, tb[FRA_SRC], | ||
151 | sizeof(struct in6_addr)); | ||
152 | |||
153 | if (tb[FRA_DST]) | ||
154 | nla_memcpy(&rule6->dst.addr, tb[FRA_DST], | ||
155 | sizeof(struct in6_addr)); | ||
156 | |||
157 | rule6->src.plen = frh->src_len; | ||
158 | rule6->dst.plen = frh->dst_len; | ||
159 | rule6->tclass = frh->tos; | ||
160 | |||
161 | err = 0; | ||
162 | errout: | ||
163 | return err; | ||
164 | } | ||
165 | |||
166 | static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh, | ||
167 | struct nlattr **tb) | ||
168 | { | ||
169 | struct fib6_rule *rule6 = (struct fib6_rule *) rule; | ||
170 | |||
171 | if (frh->src_len && (rule6->src.plen != frh->src_len)) | ||
172 | return 0; | ||
173 | |||
174 | if (frh->dst_len && (rule6->dst.plen != frh->dst_len)) | ||
175 | return 0; | ||
176 | |||
177 | if (frh->tos && (rule6->tclass != frh->tos)) | ||
178 | return 0; | ||
179 | |||
180 | if (tb[FRA_SRC] && | ||
181 | nla_memcmp(tb[FRA_SRC], &rule6->src.addr, sizeof(struct in6_addr))) | ||
182 | return 0; | ||
183 | |||
184 | if (tb[FRA_DST] && | ||
185 | nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr))) | ||
186 | return 0; | ||
187 | |||
188 | return 1; | ||
189 | } | ||
190 | |||
191 | static int fib6_rule_fill(struct fib_rule *rule, struct sk_buff *skb, | ||
192 | struct nlmsghdr *nlh, struct fib_rule_hdr *frh) | ||
193 | { | ||
194 | struct fib6_rule *rule6 = (struct fib6_rule *) rule; | ||
195 | |||
196 | frh->family = AF_INET6; | ||
197 | frh->dst_len = rule6->dst.plen; | ||
198 | frh->src_len = rule6->src.plen; | ||
199 | frh->tos = rule6->tclass; | ||
200 | |||
201 | if (rule6->dst.plen) | ||
202 | NLA_PUT(skb, FRA_DST, sizeof(struct in6_addr), | ||
203 | &rule6->dst.addr); | ||
204 | |||
205 | if (rule6->src.plen) | ||
206 | NLA_PUT(skb, FRA_SRC, sizeof(struct in6_addr), | ||
207 | &rule6->src.addr); | ||
208 | |||
209 | return 0; | ||
210 | |||
211 | nla_put_failure: | ||
212 | return -ENOBUFS; | ||
213 | } | ||
214 | |||
215 | int fib6_rules_dump(struct sk_buff *skb, struct netlink_callback *cb) | ||
216 | { | ||
217 | return fib_rules_dump(skb, cb, AF_INET6); | ||
218 | } | ||
219 | |||
220 | static u32 fib6_rule_default_pref(void) | ||
221 | { | ||
222 | return 0x3FFF; | ||
223 | } | ||
224 | |||
225 | static struct fib_rules_ops fib6_rules_ops = { | ||
226 | .family = AF_INET6, | ||
227 | .rule_size = sizeof(struct fib6_rule), | ||
228 | .action = fib6_rule_action, | ||
229 | .match = fib6_rule_match, | ||
230 | .configure = fib6_rule_configure, | ||
231 | .compare = fib6_rule_compare, | ||
232 | .fill = fib6_rule_fill, | ||
233 | .default_pref = fib6_rule_default_pref, | ||
234 | .nlgroup = RTNLGRP_IPV6_RULE, | ||
235 | .policy = fib6_rule_policy, | ||
236 | .rules_list = &fib6_rules, | ||
237 | .owner = THIS_MODULE, | ||
238 | }; | ||
239 | |||
240 | void __init fib6_rules_init(void) | ||
241 | { | ||
242 | list_add_tail(&local_rule.common.list, &fib6_rules); | ||
243 | list_add_tail(&main_rule.common.list, &fib6_rules); | ||
244 | |||
245 | fib_rules_register(&fib6_rules_ops); | ||
246 | } | ||
247 | |||
248 | void fib6_rules_cleanup(void) | ||
249 | { | ||
250 | fib_rules_unregister(&fib6_rules_ops); | ||
251 | } | ||
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index fcd7da830aca..ce226c14bef5 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -159,6 +159,15 @@ static struct fib6_table fib6_main_tbl = { | |||
159 | 159 | ||
160 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 160 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
161 | 161 | ||
162 | static struct fib6_table fib6_local_tbl = { | ||
163 | .tb6_id = RT6_TABLE_LOCAL, | ||
164 | .tb6_lock = RW_LOCK_UNLOCKED, | ||
165 | .tb6_root = { | ||
166 | .leaf = &ip6_null_entry, | ||
167 | .fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO, | ||
168 | }, | ||
169 | }; | ||
170 | |||
162 | #define FIB_TABLE_HASHSZ 256 | 171 | #define FIB_TABLE_HASHSZ 256 |
163 | static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; | 172 | static struct hlist_head fib_table_hash[FIB_TABLE_HASHSZ]; |
164 | 173 | ||
@@ -228,20 +237,10 @@ struct fib6_table *fib6_get_table(u32 id) | |||
228 | return NULL; | 237 | return NULL; |
229 | } | 238 | } |
230 | 239 | ||
231 | struct dst_entry *fib6_rule_lookup(struct flowi *fl, int flags, | ||
232 | pol_lookup_t lookup) | ||
233 | { | ||
234 | /* | ||
235 | * TODO: Add rule lookup | ||
236 | */ | ||
237 | struct fib6_table *table = fib6_get_table(RT6_TABLE_MAIN); | ||
238 | |||
239 | return (struct dst_entry *) lookup(table, fl, flags); | ||
240 | } | ||
241 | |||
242 | static void __init fib6_tables_init(void) | 240 | static void __init fib6_tables_init(void) |
243 | { | 241 | { |
244 | fib6_link_table(&fib6_main_tbl); | 242 | fib6_link_table(&fib6_main_tbl); |
243 | fib6_link_table(&fib6_local_tbl); | ||
245 | } | 244 | } |
246 | 245 | ||
247 | #else | 246 | #else |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 73efdadb9ab8..438977e2085d 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -140,6 +140,50 @@ struct rt6_info ip6_null_entry = { | |||
140 | .rt6i_ref = ATOMIC_INIT(1), | 140 | .rt6i_ref = ATOMIC_INIT(1), |
141 | }; | 141 | }; |
142 | 142 | ||
143 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
144 | |||
145 | struct rt6_info ip6_prohibit_entry = { | ||
146 | .u = { | ||
147 | .dst = { | ||
148 | .__refcnt = ATOMIC_INIT(1), | ||
149 | .__use = 1, | ||
150 | .dev = &loopback_dev, | ||
151 | .obsolete = -1, | ||
152 | .error = -EACCES, | ||
153 | .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, | ||
154 | .input = ip6_pkt_discard, | ||
155 | .output = ip6_pkt_discard_out, | ||
156 | .ops = &ip6_dst_ops, | ||
157 | .path = (struct dst_entry*)&ip6_prohibit_entry, | ||
158 | } | ||
159 | }, | ||
160 | .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), | ||
161 | .rt6i_metric = ~(u32) 0, | ||
162 | .rt6i_ref = ATOMIC_INIT(1), | ||
163 | }; | ||
164 | |||
165 | struct rt6_info ip6_blk_hole_entry = { | ||
166 | .u = { | ||
167 | .dst = { | ||
168 | .__refcnt = ATOMIC_INIT(1), | ||
169 | .__use = 1, | ||
170 | .dev = &loopback_dev, | ||
171 | .obsolete = -1, | ||
172 | .error = -EINVAL, | ||
173 | .metrics = { [RTAX_HOPLIMIT - 1] = 255, }, | ||
174 | .input = ip6_pkt_discard, | ||
175 | .output = ip6_pkt_discard_out, | ||
176 | .ops = &ip6_dst_ops, | ||
177 | .path = (struct dst_entry*)&ip6_blk_hole_entry, | ||
178 | } | ||
179 | }, | ||
180 | .rt6i_flags = (RTF_REJECT | RTF_NONEXTHOP), | ||
181 | .rt6i_metric = ~(u32) 0, | ||
182 | .rt6i_ref = ATOMIC_INIT(1), | ||
183 | }; | ||
184 | |||
185 | #endif | ||
186 | |||
143 | /* allocate dst with ip6_dst_ops */ | 187 | /* allocate dst with ip6_dst_ops */ |
144 | static __inline__ struct rt6_info *ip6_dst_alloc(void) | 188 | static __inline__ struct rt6_info *ip6_dst_alloc(void) |
145 | { | 189 | { |
@@ -2408,10 +2452,16 @@ void __init ip6_route_init(void) | |||
2408 | #ifdef CONFIG_XFRM | 2452 | #ifdef CONFIG_XFRM |
2409 | xfrm6_init(); | 2453 | xfrm6_init(); |
2410 | #endif | 2454 | #endif |
2455 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
2456 | fib6_rules_init(); | ||
2457 | #endif | ||
2411 | } | 2458 | } |
2412 | 2459 | ||
2413 | void ip6_route_cleanup(void) | 2460 | void ip6_route_cleanup(void) |
2414 | { | 2461 | { |
2462 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | ||
2463 | fib6_rules_cleanup(); | ||
2464 | #endif | ||
2415 | #ifdef CONFIG_PROC_FS | 2465 | #ifdef CONFIG_PROC_FS |
2416 | proc_net_remove("ipv6_route"); | 2466 | proc_net_remove("ipv6_route"); |
2417 | proc_net_remove("rt6_stats"); | 2467 | proc_net_remove("rt6_stats"); |