aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-07-17 13:48:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-17 13:48:26 -0400
commita6ff1a2f1e91578860b37df9fd861ef7af207de4 (patch)
tree1692579976add2fa59ab3fe008e4b0d36ec7ee30 /net/ipv6/tcp_ipv6.c
parentbd2d0837abc0206ecdd3f6b9fc8c25b55b63c96b (diff)
parent4895c771c7f006b4b90f9d6b1d2210939ba57b38 (diff)
Merge branch 'nexthop_exceptions'
These patches implement the final mechanism necessary to really allow us to go without the route cache in ipv4. We need a place to have long-term storage of PMTU/redirect information which is independent of the routes themselves, yet does not get us back into a situation where we have to write to metrics or anything like that. For this we use an "next-hop exception" table in the FIB nexthops. The one thing I desperately want to avoid is having to create clone routes in the FIB trie for this purpose, because that is very expensive. However, I'm willing to entertain such an idea later if this current scheme proves to have downsides that the FIB trie variant would not have. In order to accomodate this any such scheme, we need to be able to produce a full flow key at PMTU/redirect time. That required an adjustment of the interface call-sites used to propagate these events. For a PMTU/redirect with a fully specified socket, we pass that socket and use it to produce the flow key. Otherwise we use a passed in SKB to formulate the key. There are two cases that need to be distinguished, ICMP message processing (in which case the IP header is at skb->data) and output packet processing (mostly tunnels, and in all such cases the IP header is at ip_hdr(skb)). We also have to make the code able to handle the case where the dst itself passed into the dst_ops->{update_pmtu,redirect} method is invalidated. This matters for calls from sockets that have cached that route. We provide a inet{,6} helper function for this purpose, and edit SCTP specially since it caches routes at the transport rather than socket level. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3071f377145c..c9dabdd832d7 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -367,7 +367,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
367 struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie); 367 struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
368 368
369 if (dst) 369 if (dst)
370 dst->ops->redirect(dst,skb); 370 dst->ops->redirect(dst, sk, skb);
371 } 371 }
372 372
373 if (type == ICMPV6_PKT_TOOBIG) { 373 if (type == ICMPV6_PKT_TOOBIG) {
@@ -378,43 +378,14 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
378 if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) 378 if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))
379 goto out; 379 goto out;
380 380
381 /* icmp should have updated the destination cache entry */ 381 dst = inet6_csk_update_pmtu(sk, ntohl(info));
382 dst = __sk_dst_check(sk, np->dst_cookie); 382 if (!dst)
383 383 goto out;
384 if (dst == NULL) {
385 struct inet_sock *inet = inet_sk(sk);
386 struct flowi6 fl6;
387
388 /* BUGGG_FUTURE: Again, it is not clear how
389 to handle rthdr case. Ignore this complexity
390 for now.
391 */
392 memset(&fl6, 0, sizeof(fl6));
393 fl6.flowi6_proto = IPPROTO_TCP;
394 fl6.daddr = np->daddr;
395 fl6.saddr = np->saddr;
396 fl6.flowi6_oif = sk->sk_bound_dev_if;
397 fl6.flowi6_mark = sk->sk_mark;
398 fl6.fl6_dport = inet->inet_dport;
399 fl6.fl6_sport = inet->inet_sport;
400 security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
401
402 dst = ip6_dst_lookup_flow(sk, &fl6, NULL, false);
403 if (IS_ERR(dst)) {
404 sk->sk_err_soft = -PTR_ERR(dst);
405 goto out;
406 }
407
408 } else
409 dst_hold(dst);
410
411 dst->ops->update_pmtu(dst, ntohl(info));
412 384
413 if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst)) { 385 if (inet_csk(sk)->icsk_pmtu_cookie > dst_mtu(dst)) {
414 tcp_sync_mss(sk, dst_mtu(dst)); 386 tcp_sync_mss(sk, dst_mtu(dst));
415 tcp_simple_retransmit(sk); 387 tcp_simple_retransmit(sk);
416 } /* else let the usual retransmit timer handle it */ 388 }
417 dst_release(dst);
418 goto out; 389 goto out;
419 } 390 }
420 391