diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-27 20:05:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-27 20:05:06 -0400 |
commit | c10237e077cef50e925f052e49f3b4fead9d71f9 (patch) | |
tree | 5b7418f3a31165ea2e7d119782cad0745cd45792 | |
parent | e440cf2ca0a1b075c64016240d46c3aa9d877bbf (diff) |
Revert "ipv4: tcp: dont cache unconfirmed intput dst"
This reverts commit c074da2810c118b3812f32d6754bd9ead2f169e7.
This change has several unwanted side effects:
1) Sockets will cache the DST_NOCACHE route in sk->sk_rx_dst and we'll
thus never create a real cached route.
2) All TCP traffic will use DST_NOCACHE and never use the routing
cache at all.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/protocol.h | 2 | ||||
-rw-r--r-- | include/net/route.h | 8 | ||||
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/ipv4/arp.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_input.c | 5 | ||||
-rw-r--r-- | net/ipv4/route.c | 8 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 | ||||
-rw-r--r-- | net/ipv4/xfrm4_input.c | 2 |
9 files changed, 15 insertions, 20 deletions
diff --git a/include/net/protocol.h b/include/net/protocol.h index 7cfc8f76914d..967b926cbfb1 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | /* This is used to register protocols. */ | 38 | /* This is used to register protocols. */ |
39 | struct net_protocol { | 39 | struct net_protocol { |
40 | int (*early_demux)(struct sk_buff *skb, bool *nocache); | 40 | int (*early_demux)(struct sk_buff *skb); |
41 | int (*handler)(struct sk_buff *skb); | 41 | int (*handler)(struct sk_buff *skb); |
42 | void (*err_handler)(struct sk_buff *skb, u32 info); | 42 | void (*err_handler)(struct sk_buff *skb, u32 info); |
43 | int (*gso_send_check)(struct sk_buff *skb); | 43 | int (*gso_send_check)(struct sk_buff *skb); |
diff --git a/include/net/route.h b/include/net/route.h index 6361f9335774..47eb25ac1f7f 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -201,18 +201,18 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4 | |||
201 | } | 201 | } |
202 | 202 | ||
203 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, | 203 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, |
204 | u8 tos, struct net_device *devin, bool noref, bool nocache); | 204 | u8 tos, struct net_device *devin, bool noref); |
205 | 205 | ||
206 | static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, | 206 | static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, |
207 | u8 tos, struct net_device *devin) | 207 | u8 tos, struct net_device *devin) |
208 | { | 208 | { |
209 | return ip_route_input_common(skb, dst, src, tos, devin, false, false); | 209 | return ip_route_input_common(skb, dst, src, tos, devin, false); |
210 | } | 210 | } |
211 | 211 | ||
212 | static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src, | 212 | static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src, |
213 | u8 tos, struct net_device *devin, bool nocache) | 213 | u8 tos, struct net_device *devin) |
214 | { | 214 | { |
215 | return ip_route_input_common(skb, dst, src, tos, devin, true, nocache); | 215 | return ip_route_input_common(skb, dst, src, tos, devin, true); |
216 | } | 216 | } |
217 | 217 | ||
218 | extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, | 218 | extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, |
diff --git a/include/net/tcp.h b/include/net/tcp.h index 917ed2e55e8c..6660ffc4963d 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -325,7 +325,7 @@ extern void tcp_v4_err(struct sk_buff *skb, u32); | |||
325 | 325 | ||
326 | extern void tcp_shutdown (struct sock *sk, int how); | 326 | extern void tcp_shutdown (struct sock *sk, int how); |
327 | 327 | ||
328 | extern int tcp_v4_early_demux(struct sk_buff *skb, bool *nocache); | 328 | extern int tcp_v4_early_demux(struct sk_buff *skb); |
329 | extern int tcp_v4_rcv(struct sk_buff *skb); | 329 | extern int tcp_v4_rcv(struct sk_buff *skb); |
330 | 330 | ||
331 | extern struct inet_peer *tcp_v4_get_peer(struct sock *sk); | 331 | extern struct inet_peer *tcp_v4_get_peer(struct sock *sk); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 6a9795944369..2e560f0c757d 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -828,7 +828,7 @@ static int arp_process(struct sk_buff *skb) | |||
828 | } | 828 | } |
829 | 829 | ||
830 | if (arp->ar_op == htons(ARPOP_REQUEST) && | 830 | if (arp->ar_op == htons(ARPOP_REQUEST) && |
831 | ip_route_input_noref(skb, tip, sip, 0, dev, false) == 0) { | 831 | ip_route_input_noref(skb, tip, sip, 0, dev) == 0) { |
832 | 832 | ||
833 | rt = skb_rtable(skb); | 833 | rt = skb_rtable(skb); |
834 | addr_type = rt->rt_type; | 834 | addr_type = rt->rt_type; |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 978d55f256ea..8d07c973409c 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -259,7 +259,7 @@ static void ip_expire(unsigned long arg) | |||
259 | skb_dst_drop(head); | 259 | skb_dst_drop(head); |
260 | iph = ip_hdr(head); | 260 | iph = ip_hdr(head); |
261 | err = ip_route_input_noref(head, iph->daddr, iph->saddr, | 261 | err = ip_route_input_noref(head, iph->daddr, iph->saddr, |
262 | iph->tos, head->dev, false); | 262 | iph->tos, head->dev); |
263 | if (err) | 263 | if (err) |
264 | goto out_rcu_unlock; | 264 | goto out_rcu_unlock; |
265 | 265 | ||
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 7be54c8dcbe2..2a39204de5bc 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -326,7 +326,6 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
326 | */ | 326 | */ |
327 | if (skb_dst(skb) == NULL) { | 327 | if (skb_dst(skb) == NULL) { |
328 | int err = -ENOENT; | 328 | int err = -ENOENT; |
329 | bool nocache = false; | ||
330 | 329 | ||
331 | if (sysctl_ip_early_demux) { | 330 | if (sysctl_ip_early_demux) { |
332 | const struct net_protocol *ipprot; | 331 | const struct net_protocol *ipprot; |
@@ -335,13 +334,13 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
335 | rcu_read_lock(); | 334 | rcu_read_lock(); |
336 | ipprot = rcu_dereference(inet_protos[protocol]); | 335 | ipprot = rcu_dereference(inet_protos[protocol]); |
337 | if (ipprot && ipprot->early_demux) | 336 | if (ipprot && ipprot->early_demux) |
338 | err = ipprot->early_demux(skb, &nocache); | 337 | err = ipprot->early_demux(skb); |
339 | rcu_read_unlock(); | 338 | rcu_read_unlock(); |
340 | } | 339 | } |
341 | 340 | ||
342 | if (err) { | 341 | if (err) { |
343 | err = ip_route_input_noref(skb, iph->daddr, iph->saddr, | 342 | err = ip_route_input_noref(skb, iph->daddr, iph->saddr, |
344 | iph->tos, skb->dev, nocache); | 343 | iph->tos, skb->dev); |
345 | if (unlikely(err)) { | 344 | if (unlikely(err)) { |
346 | if (err == -EXDEV) | 345 | if (err == -EXDEV) |
347 | NET_INC_STATS_BH(dev_net(skb->dev), | 346 | NET_INC_STATS_BH(dev_net(skb->dev), |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index fdc7900f9d7a..81533e3a23d1 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2214,7 +2214,7 @@ static int ip_mkroute_input(struct sk_buff *skb, | |||
2214 | */ | 2214 | */ |
2215 | 2215 | ||
2216 | static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | 2216 | static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
2217 | u8 tos, struct net_device *dev, bool nocache) | 2217 | u8 tos, struct net_device *dev) |
2218 | { | 2218 | { |
2219 | struct fib_result res; | 2219 | struct fib_result res; |
2220 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 2220 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
@@ -2353,8 +2353,6 @@ local_input: | |||
2353 | rth->dst.error= -err; | 2353 | rth->dst.error= -err; |
2354 | rth->rt_flags &= ~RTCF_LOCAL; | 2354 | rth->rt_flags &= ~RTCF_LOCAL; |
2355 | } | 2355 | } |
2356 | if (nocache) | ||
2357 | rth->dst.flags |= DST_NOCACHE; | ||
2358 | hash = rt_hash(daddr, saddr, fl4.flowi4_iif, rt_genid(net)); | 2356 | hash = rt_hash(daddr, saddr, fl4.flowi4_iif, rt_genid(net)); |
2359 | rth = rt_intern_hash(hash, rth, skb, fl4.flowi4_iif); | 2357 | rth = rt_intern_hash(hash, rth, skb, fl4.flowi4_iif); |
2360 | err = 0; | 2358 | err = 0; |
@@ -2397,7 +2395,7 @@ martian_source_keep_err: | |||
2397 | } | 2395 | } |
2398 | 2396 | ||
2399 | int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | 2397 | int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
2400 | u8 tos, struct net_device *dev, bool noref, bool nocache) | 2398 | u8 tos, struct net_device *dev, bool noref) |
2401 | { | 2399 | { |
2402 | struct rtable *rth; | 2400 | struct rtable *rth; |
2403 | unsigned int hash; | 2401 | unsigned int hash; |
@@ -2473,7 +2471,7 @@ skip_cache: | |||
2473 | rcu_read_unlock(); | 2471 | rcu_read_unlock(); |
2474 | return -EINVAL; | 2472 | return -EINVAL; |
2475 | } | 2473 | } |
2476 | res = ip_route_input_slow(skb, daddr, saddr, tos, dev, nocache); | 2474 | res = ip_route_input_slow(skb, daddr, saddr, tos, dev); |
2477 | rcu_read_unlock(); | 2475 | rcu_read_unlock(); |
2478 | return res; | 2476 | return res; |
2479 | } | 2477 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 33aabd4fc20f..1781dc650b9d 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1673,7 +1673,7 @@ csum_err: | |||
1673 | } | 1673 | } |
1674 | EXPORT_SYMBOL(tcp_v4_do_rcv); | 1674 | EXPORT_SYMBOL(tcp_v4_do_rcv); |
1675 | 1675 | ||
1676 | int tcp_v4_early_demux(struct sk_buff *skb, bool *no_dst_cache) | 1676 | int tcp_v4_early_demux(struct sk_buff *skb) |
1677 | { | 1677 | { |
1678 | struct net *net = dev_net(skb->dev); | 1678 | struct net *net = dev_net(skb->dev); |
1679 | const struct iphdr *iph; | 1679 | const struct iphdr *iph; |
@@ -1719,8 +1719,6 @@ int tcp_v4_early_demux(struct sk_buff *skb, bool *no_dst_cache) | |||
1719 | } | 1719 | } |
1720 | } | 1720 | } |
1721 | } | 1721 | } |
1722 | } else { | ||
1723 | *no_dst_cache = true; | ||
1724 | } | 1722 | } |
1725 | 1723 | ||
1726 | out_err: | 1724 | out_err: |
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index eee636b191b9..06814b6216dc 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c | |||
@@ -28,7 +28,7 @@ static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb) | |||
28 | const struct iphdr *iph = ip_hdr(skb); | 28 | const struct iphdr *iph = ip_hdr(skb); |
29 | 29 | ||
30 | if (ip_route_input_noref(skb, iph->daddr, iph->saddr, | 30 | if (ip_route_input_noref(skb, iph->daddr, iph->saddr, |
31 | iph->tos, skb->dev, false)) | 31 | iph->tos, skb->dev)) |
32 | goto drop; | 32 | goto drop; |
33 | } | 33 | } |
34 | return dst_input(skb); | 34 | return dst_input(skb); |