diff options
author | Paul Mundt <lethal@linux-sh.org> | 2012-08-01 00:49:13 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2012-08-01 00:49:13 -0400 |
commit | 91ba548cfd5cc8ee93b9435527efb8fa4caf5c5e (patch) | |
tree | c96ed92413044a28d17783e84a8824bfd2437af1 /net/ipv6/tcp_ipv6.c | |
parent | b9ccfda293ee6fca9a89a1584f0900e0627b975e (diff) | |
parent | 4dc4c51675c137c30838425ecc8d471ff5eb138b (diff) |
Merge branch 'sh/dmaengine' into sh-latest
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index f49476e2d884..c66b90f71c9b 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1299,7 +1299,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1299 | /* Clone pktoptions received with SYN */ | 1299 | /* Clone pktoptions received with SYN */ |
1300 | newnp->pktoptions = NULL; | 1300 | newnp->pktoptions = NULL; |
1301 | if (treq->pktopts != NULL) { | 1301 | if (treq->pktopts != NULL) { |
1302 | newnp->pktoptions = skb_clone(treq->pktopts, GFP_ATOMIC); | 1302 | newnp->pktoptions = skb_clone(treq->pktopts, |
1303 | sk_gfp_atomic(sk, GFP_ATOMIC)); | ||
1303 | consume_skb(treq->pktopts); | 1304 | consume_skb(treq->pktopts); |
1304 | treq->pktopts = NULL; | 1305 | treq->pktopts = NULL; |
1305 | if (newnp->pktoptions) | 1306 | if (newnp->pktoptions) |
@@ -1349,7 +1350,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1349 | * across. Shucks. | 1350 | * across. Shucks. |
1350 | */ | 1351 | */ |
1351 | tcp_md5_do_add(newsk, (union tcp_md5_addr *)&newnp->daddr, | 1352 | tcp_md5_do_add(newsk, (union tcp_md5_addr *)&newnp->daddr, |
1352 | AF_INET6, key->key, key->keylen, GFP_ATOMIC); | 1353 | AF_INET6, key->key, key->keylen, |
1354 | sk_gfp_atomic(sk, GFP_ATOMIC)); | ||
1353 | } | 1355 | } |
1354 | #endif | 1356 | #endif |
1355 | 1357 | ||
@@ -1442,7 +1444,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
1442 | --ANK (980728) | 1444 | --ANK (980728) |
1443 | */ | 1445 | */ |
1444 | if (np->rxopt.all) | 1446 | if (np->rxopt.all) |
1445 | opt_skb = skb_clone(skb, GFP_ATOMIC); | 1447 | opt_skb = skb_clone(skb, sk_gfp_atomic(sk, GFP_ATOMIC)); |
1446 | 1448 | ||
1447 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ | 1449 | if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ |
1448 | sock_rps_save_rxhash(sk, skb); | 1450 | sock_rps_save_rxhash(sk, skb); |
@@ -1674,6 +1676,43 @@ do_time_wait: | |||
1674 | goto discard_it; | 1676 | goto discard_it; |
1675 | } | 1677 | } |
1676 | 1678 | ||
1679 | static void tcp_v6_early_demux(struct sk_buff *skb) | ||
1680 | { | ||
1681 | const struct ipv6hdr *hdr; | ||
1682 | const struct tcphdr *th; | ||
1683 | struct sock *sk; | ||
1684 | |||
1685 | if (skb->pkt_type != PACKET_HOST) | ||
1686 | return; | ||
1687 | |||
1688 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr))) | ||
1689 | return; | ||
1690 | |||
1691 | hdr = ipv6_hdr(skb); | ||
1692 | th = tcp_hdr(skb); | ||
1693 | |||
1694 | if (th->doff < sizeof(struct tcphdr) / 4) | ||
1695 | return; | ||
1696 | |||
1697 | sk = __inet6_lookup_established(dev_net(skb->dev), &tcp_hashinfo, | ||
1698 | &hdr->saddr, th->source, | ||
1699 | &hdr->daddr, ntohs(th->dest), | ||
1700 | inet6_iif(skb)); | ||
1701 | if (sk) { | ||
1702 | skb->sk = sk; | ||
1703 | skb->destructor = sock_edemux; | ||
1704 | if (sk->sk_state != TCP_TIME_WAIT) { | ||
1705 | struct dst_entry *dst = sk->sk_rx_dst; | ||
1706 | struct inet_sock *icsk = inet_sk(sk); | ||
1707 | if (dst) | ||
1708 | dst = dst_check(dst, 0); | ||
1709 | if (dst && | ||
1710 | icsk->rx_dst_ifindex == inet6_iif(skb)) | ||
1711 | skb_dst_set_noref(skb, dst); | ||
1712 | } | ||
1713 | } | ||
1714 | } | ||
1715 | |||
1677 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { | 1716 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { |
1678 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), | 1717 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), |
1679 | .twsk_unique = tcp_twsk_unique, | 1718 | .twsk_unique = tcp_twsk_unique, |
@@ -1978,12 +2017,13 @@ struct proto tcpv6_prot = { | |||
1978 | .compat_setsockopt = compat_tcp_setsockopt, | 2017 | .compat_setsockopt = compat_tcp_setsockopt, |
1979 | .compat_getsockopt = compat_tcp_getsockopt, | 2018 | .compat_getsockopt = compat_tcp_getsockopt, |
1980 | #endif | 2019 | #endif |
1981 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM | 2020 | #ifdef CONFIG_MEMCG_KMEM |
1982 | .proto_cgroup = tcp_proto_cgroup, | 2021 | .proto_cgroup = tcp_proto_cgroup, |
1983 | #endif | 2022 | #endif |
1984 | }; | 2023 | }; |
1985 | 2024 | ||
1986 | static const struct inet6_protocol tcpv6_protocol = { | 2025 | static const struct inet6_protocol tcpv6_protocol = { |
2026 | .early_demux = tcp_v6_early_demux, | ||
1987 | .handler = tcp_v6_rcv, | 2027 | .handler = tcp_v6_rcv, |
1988 | .err_handler = tcp_v6_err, | 2028 | .err_handler = tcp_v6_err, |
1989 | .gso_send_check = tcp_v6_gso_send_check, | 2029 | .gso_send_check = tcp_v6_gso_send_check, |