diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-28 07:05:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-28 07:05:27 -0400 |
commit | 41347dcdd81988b8e60853257b2875285cc17a4e (patch) | |
tree | 29ced900bcde5d9afc252d0b10fdfe6d2e18cc66 /net | |
parent | 35ebf65e851c6d9731abc6362b189858eb59f4d3 (diff) |
ipv4: Kill rt->rt_spec_dst, no longer used.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/fib_frontend.c | 9 | ||||
-rw-r--r-- | net/ipv4/route.c | 38 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 1 |
3 files changed, 11 insertions, 37 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 451939b60c54..63b11ca54d95 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -218,8 +218,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb) | |||
218 | * called with rcu_read_lock() | 218 | * called with rcu_read_lock() |
219 | */ | 219 | */ |
220 | int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, | 220 | int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, |
221 | int oif, struct net_device *dev, __be32 *spec_dst, | 221 | int oif, struct net_device *dev, u32 *itag) |
222 | u32 *itag) | ||
223 | { | 222 | { |
224 | struct in_device *in_dev; | 223 | struct in_device *in_dev; |
225 | struct flowi4 fl4; | 224 | struct flowi4 fl4; |
@@ -258,7 +257,6 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, | |||
258 | if (res.type != RTN_LOCAL || !accept_local) | 257 | if (res.type != RTN_LOCAL || !accept_local) |
259 | goto e_inval; | 258 | goto e_inval; |
260 | } | 259 | } |
261 | *spec_dst = FIB_RES_PREFSRC(net, res); | ||
262 | fib_combine_itag(itag, &res); | 260 | fib_combine_itag(itag, &res); |
263 | dev_match = false; | 261 | dev_match = false; |
264 | 262 | ||
@@ -287,17 +285,14 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, | |||
287 | 285 | ||
288 | ret = 0; | 286 | ret = 0; |
289 | if (fib_lookup(net, &fl4, &res) == 0) { | 287 | if (fib_lookup(net, &fl4, &res) == 0) { |
290 | if (res.type == RTN_UNICAST) { | 288 | if (res.type == RTN_UNICAST) |
291 | *spec_dst = FIB_RES_PREFSRC(net, res); | ||
292 | ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; | 289 | ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; |
293 | } | ||
294 | } | 290 | } |
295 | return ret; | 291 | return ret; |
296 | 292 | ||
297 | last_resort: | 293 | last_resort: |
298 | if (rpf) | 294 | if (rpf) |
299 | goto e_rpf; | 295 | goto e_rpf; |
300 | *spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); | ||
301 | *itag = 0; | 296 | *itag = 0; |
302 | return 0; | 297 | return 0; |
303 | 298 | ||
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 81533e3a23d1..83d56a016625 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -440,7 +440,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
440 | r->rt_key_tos, | 440 | r->rt_key_tos, |
441 | -1, | 441 | -1, |
442 | HHUptod, | 442 | HHUptod, |
443 | r->rt_spec_dst, &len); | 443 | 0, &len); |
444 | 444 | ||
445 | seq_printf(seq, "%*s\n", 127 - len, ""); | 445 | seq_printf(seq, "%*s\n", 127 - len, ""); |
446 | } | 446 | } |
@@ -1978,7 +1978,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1978 | { | 1978 | { |
1979 | unsigned int hash; | 1979 | unsigned int hash; |
1980 | struct rtable *rth; | 1980 | struct rtable *rth; |
1981 | __be32 spec_dst; | ||
1982 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 1981 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
1983 | u32 itag = 0; | 1982 | u32 itag = 0; |
1984 | int err; | 1983 | int err; |
@@ -1999,10 +1998,8 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1999 | if (ipv4_is_zeronet(saddr)) { | 1998 | if (ipv4_is_zeronet(saddr)) { |
2000 | if (!ipv4_is_local_multicast(daddr)) | 1999 | if (!ipv4_is_local_multicast(daddr)) |
2001 | goto e_inval; | 2000 | goto e_inval; |
2002 | spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); | ||
2003 | } else { | 2001 | } else { |
2004 | err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &spec_dst, | 2002 | err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &itag); |
2005 | &itag); | ||
2006 | if (err < 0) | 2003 | if (err < 0) |
2007 | goto e_err; | 2004 | goto e_err; |
2008 | } | 2005 | } |
@@ -2029,7 +2026,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2029 | rth->rt_oif = 0; | 2026 | rth->rt_oif = 0; |
2030 | rth->rt_mark = skb->mark; | 2027 | rth->rt_mark = skb->mark; |
2031 | rth->rt_gateway = daddr; | 2028 | rth->rt_gateway = daddr; |
2032 | rth->rt_spec_dst= spec_dst; | ||
2033 | rth->rt_peer_genid = 0; | 2029 | rth->rt_peer_genid = 0; |
2034 | rt_init_peer(rth, dev_net(dev)->ipv4.peers); | 2030 | rt_init_peer(rth, dev_net(dev)->ipv4.peers); |
2035 | rth->fi = NULL; | 2031 | rth->fi = NULL; |
@@ -2093,7 +2089,6 @@ static int __mkroute_input(struct sk_buff *skb, | |||
2093 | int err; | 2089 | int err; |
2094 | struct in_device *out_dev; | 2090 | struct in_device *out_dev; |
2095 | unsigned int flags = 0; | 2091 | unsigned int flags = 0; |
2096 | __be32 spec_dst; | ||
2097 | u32 itag; | 2092 | u32 itag; |
2098 | 2093 | ||
2099 | /* get a working reference to the output device */ | 2094 | /* get a working reference to the output device */ |
@@ -2105,7 +2100,7 @@ static int __mkroute_input(struct sk_buff *skb, | |||
2105 | 2100 | ||
2106 | 2101 | ||
2107 | err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res), | 2102 | err = fib_validate_source(skb, saddr, daddr, tos, FIB_RES_OIF(*res), |
2108 | in_dev->dev, &spec_dst, &itag); | 2103 | in_dev->dev, &itag); |
2109 | if (err < 0) { | 2104 | if (err < 0) { |
2110 | ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, | 2105 | ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, |
2111 | saddr); | 2106 | saddr); |
@@ -2157,7 +2152,6 @@ static int __mkroute_input(struct sk_buff *skb, | |||
2157 | rth->rt_oif = 0; | 2152 | rth->rt_oif = 0; |
2158 | rth->rt_mark = skb->mark; | 2153 | rth->rt_mark = skb->mark; |
2159 | rth->rt_gateway = daddr; | 2154 | rth->rt_gateway = daddr; |
2160 | rth->rt_spec_dst= spec_dst; | ||
2161 | rth->rt_peer_genid = 0; | 2155 | rth->rt_peer_genid = 0; |
2162 | rt_init_peer(rth, &res->table->tb_peers); | 2156 | rt_init_peer(rth, &res->table->tb_peers); |
2163 | rth->fi = NULL; | 2157 | rth->fi = NULL; |
@@ -2223,7 +2217,6 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2223 | u32 itag = 0; | 2217 | u32 itag = 0; |
2224 | struct rtable *rth; | 2218 | struct rtable *rth; |
2225 | unsigned int hash; | 2219 | unsigned int hash; |
2226 | __be32 spec_dst; | ||
2227 | int err = -EINVAL; | 2220 | int err = -EINVAL; |
2228 | struct net *net = dev_net(dev); | 2221 | struct net *net = dev_net(dev); |
2229 | 2222 | ||
@@ -2281,12 +2274,11 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2281 | if (res.type == RTN_LOCAL) { | 2274 | if (res.type == RTN_LOCAL) { |
2282 | err = fib_validate_source(skb, saddr, daddr, tos, | 2275 | err = fib_validate_source(skb, saddr, daddr, tos, |
2283 | net->loopback_dev->ifindex, | 2276 | net->loopback_dev->ifindex, |
2284 | dev, &spec_dst, &itag); | 2277 | dev, &itag); |
2285 | if (err < 0) | 2278 | if (err < 0) |
2286 | goto martian_source_keep_err; | 2279 | goto martian_source_keep_err; |
2287 | if (err) | 2280 | if (err) |
2288 | flags |= RTCF_DIRECTSRC; | 2281 | flags |= RTCF_DIRECTSRC; |
2289 | spec_dst = daddr; | ||
2290 | goto local_input; | 2282 | goto local_input; |
2291 | } | 2283 | } |
2292 | 2284 | ||
@@ -2302,11 +2294,8 @@ brd_input: | |||
2302 | if (skb->protocol != htons(ETH_P_IP)) | 2294 | if (skb->protocol != htons(ETH_P_IP)) |
2303 | goto e_inval; | 2295 | goto e_inval; |
2304 | 2296 | ||
2305 | if (ipv4_is_zeronet(saddr)) | 2297 | if (!ipv4_is_zeronet(saddr)) { |
2306 | spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); | 2298 | err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &itag); |
2307 | else { | ||
2308 | err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &spec_dst, | ||
2309 | &itag); | ||
2310 | if (err < 0) | 2299 | if (err < 0) |
2311 | goto martian_source_keep_err; | 2300 | goto martian_source_keep_err; |
2312 | if (err) | 2301 | if (err) |
@@ -2344,7 +2333,6 @@ local_input: | |||
2344 | rth->rt_oif = 0; | 2333 | rth->rt_oif = 0; |
2345 | rth->rt_mark = skb->mark; | 2334 | rth->rt_mark = skb->mark; |
2346 | rth->rt_gateway = daddr; | 2335 | rth->rt_gateway = daddr; |
2347 | rth->rt_spec_dst= spec_dst; | ||
2348 | rth->rt_peer_genid = 0; | 2336 | rth->rt_peer_genid = 0; |
2349 | rt_init_peer(rth, net->ipv4.peers); | 2337 | rt_init_peer(rth, net->ipv4.peers); |
2350 | rth->fi = NULL; | 2338 | rth->fi = NULL; |
@@ -2362,7 +2350,6 @@ local_input: | |||
2362 | 2350 | ||
2363 | no_route: | 2351 | no_route: |
2364 | RT_CACHE_STAT_INC(in_no_route); | 2352 | RT_CACHE_STAT_INC(in_no_route); |
2365 | spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE); | ||
2366 | res.type = RTN_UNREACHABLE; | 2353 | res.type = RTN_UNREACHABLE; |
2367 | if (err == -ESRCH) | 2354 | if (err == -ESRCH) |
2368 | err = -ENETUNREACH; | 2355 | err = -ENETUNREACH; |
@@ -2545,7 +2532,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2545 | rth->rt_oif = orig_oif; | 2532 | rth->rt_oif = orig_oif; |
2546 | rth->rt_mark = fl4->flowi4_mark; | 2533 | rth->rt_mark = fl4->flowi4_mark; |
2547 | rth->rt_gateway = fl4->daddr; | 2534 | rth->rt_gateway = fl4->daddr; |
2548 | rth->rt_spec_dst= fl4->saddr; | ||
2549 | rth->rt_peer_genid = 0; | 2535 | rth->rt_peer_genid = 0; |
2550 | rt_init_peer(rth, (res->table ? | 2536 | rt_init_peer(rth, (res->table ? |
2551 | &res->table->tb_peers : | 2537 | &res->table->tb_peers : |
@@ -2554,12 +2540,9 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2554 | 2540 | ||
2555 | RT_CACHE_STAT_INC(out_slow_tot); | 2541 | RT_CACHE_STAT_INC(out_slow_tot); |
2556 | 2542 | ||
2557 | if (flags & RTCF_LOCAL) { | 2543 | if (flags & RTCF_LOCAL) |
2558 | rth->dst.input = ip_local_deliver; | 2544 | rth->dst.input = ip_local_deliver; |
2559 | rth->rt_spec_dst = fl4->daddr; | ||
2560 | } | ||
2561 | if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { | 2545 | if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) { |
2562 | rth->rt_spec_dst = fl4->saddr; | ||
2563 | if (flags & RTCF_LOCAL && | 2546 | if (flags & RTCF_LOCAL && |
2564 | !(dev_out->flags & IFF_LOOPBACK)) { | 2547 | !(dev_out->flags & IFF_LOOPBACK)) { |
2565 | rth->dst.output = ip_mc_output; | 2548 | rth->dst.output = ip_mc_output; |
@@ -2890,7 +2873,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or | |||
2890 | rt->rt_dst = ort->rt_dst; | 2873 | rt->rt_dst = ort->rt_dst; |
2891 | rt->rt_src = ort->rt_src; | 2874 | rt->rt_src = ort->rt_src; |
2892 | rt->rt_gateway = ort->rt_gateway; | 2875 | rt->rt_gateway = ort->rt_gateway; |
2893 | rt->rt_spec_dst = ort->rt_spec_dst; | ||
2894 | rt_transfer_peer(rt, ort); | 2876 | rt_transfer_peer(rt, ort); |
2895 | rt->fi = ort->fi; | 2877 | rt->fi = ort->fi; |
2896 | if (rt->fi) | 2878 | if (rt->fi) |
@@ -2965,10 +2947,8 @@ static int rt_fill_info(struct net *net, | |||
2965 | nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid)) | 2947 | nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid)) |
2966 | goto nla_put_failure; | 2948 | goto nla_put_failure; |
2967 | #endif | 2949 | #endif |
2968 | if (rt_is_input_route(rt)) { | 2950 | if (!rt_is_input_route(rt) && |
2969 | if (nla_put_be32(skb, RTA_PREFSRC, rt->rt_spec_dst)) | 2951 | rt->rt_src != rt->rt_key_src) { |
2970 | goto nla_put_failure; | ||
2971 | } else if (rt->rt_src != rt->rt_key_src) { | ||
2972 | if (nla_put_be32(skb, RTA_PREFSRC, rt->rt_src)) | 2952 | if (nla_put_be32(skb, RTA_PREFSRC, rt->rt_src)) |
2973 | goto nla_put_failure; | 2953 | goto nla_put_failure; |
2974 | } | 2954 | } |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 8855d8268552..9815ea0bca7f 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -100,7 +100,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, | |||
100 | xdst->u.rt.rt_src = rt->rt_src; | 100 | xdst->u.rt.rt_src = rt->rt_src; |
101 | xdst->u.rt.rt_dst = rt->rt_dst; | 101 | xdst->u.rt.rt_dst = rt->rt_dst; |
102 | xdst->u.rt.rt_gateway = rt->rt_gateway; | 102 | xdst->u.rt.rt_gateway = rt->rt_gateway; |
103 | xdst->u.rt.rt_spec_dst = rt->rt_spec_dst; | ||
104 | 103 | ||
105 | return 0; | 104 | return 0; |
106 | } | 105 | } |