diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-08-04 06:39:02 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:53:41 -0400 |
commit | 101367c2f8c464ea96643192673aa18d88e6336d (patch) | |
tree | bf129373fb6f9e168671f42bf597e5564cdfbd42 /net/ipv6/route.c | |
parent | 14c0b97ddfc2944982d078b8e33b088840068976 (diff) |
[IPV6]: Policy Routing Rules
Adds support for policy routing rules including a new
local table for routes with a local destination.
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 50 |
1 files changed, 50 insertions, 0 deletions
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"); |