aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-07-27 02:23:40 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-27 16:45:51 -0400
commit505fbcf035c245a1a42cd80184feecf61ee868dc (patch)
tree6931cf7a377b79e2bbb227f32f2f0856fe4d87a2 /net/ipv4
parentb1beb681cba5358f62e6187340660ade226a5fcc (diff)
ipv4: fix TCP early demux
commit 92101b3b2e317 (ipv4: Prepare for change of rt->rt_iif encoding.) invalidated TCP early demux, because rx_dst_ifindex is not properly initialized and checked. Also remove the use of inet_iif(skb) in favor or skb->skb_iif Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_input.c1
-rw-r--r--net/ipv4/tcp_ipv4.c14
-rw-r--r--net/ipv4/tcp_minisocks.c1
3 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 3e07a64ca44e..aa659e825054 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5603,6 +5603,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
5603 5603
5604 if (skb != NULL) { 5604 if (skb != NULL) {
5605 sk->sk_rx_dst = dst_clone(skb_dst(skb)); 5605 sk->sk_rx_dst = dst_clone(skb_dst(skb));
5606 inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
5606 security_inet_conn_established(sk, skb); 5607 security_inet_conn_established(sk, skb);
5607 } 5608 }
5608 5609
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b6b07c93924c..2fbd9921253f 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1620,17 +1620,15 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
1620 sock_rps_save_rxhash(sk, skb); 1620 sock_rps_save_rxhash(sk, skb);
1621 if (sk->sk_rx_dst) { 1621 if (sk->sk_rx_dst) {
1622 struct dst_entry *dst = sk->sk_rx_dst; 1622 struct dst_entry *dst = sk->sk_rx_dst;
1623 if (dst->ops->check(dst, 0) == NULL) { 1623 if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif ||
1624 dst->ops->check(dst, 0) == NULL) {
1624 dst_release(dst); 1625 dst_release(dst);
1625 sk->sk_rx_dst = NULL; 1626 sk->sk_rx_dst = NULL;
1626 } 1627 }
1627 } 1628 }
1628 if (unlikely(sk->sk_rx_dst == NULL)) { 1629 if (unlikely(sk->sk_rx_dst == NULL)) {
1629 struct inet_sock *icsk = inet_sk(sk); 1630 sk->sk_rx_dst = dst_clone(skb_dst(skb));
1630 struct rtable *rt = skb_rtable(skb); 1631 inet_sk(sk)->rx_dst_ifindex = skb->skb_iif;
1631
1632 sk->sk_rx_dst = dst_clone(&rt->dst);
1633 icsk->rx_dst_ifindex = inet_iif(skb);
1634 } 1632 }
1635 if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) { 1633 if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) {
1636 rsk = sk; 1634 rsk = sk;
@@ -1709,11 +1707,11 @@ void tcp_v4_early_demux(struct sk_buff *skb)
1709 skb->destructor = sock_edemux; 1707 skb->destructor = sock_edemux;
1710 if (sk->sk_state != TCP_TIME_WAIT) { 1708 if (sk->sk_state != TCP_TIME_WAIT) {
1711 struct dst_entry *dst = sk->sk_rx_dst; 1709 struct dst_entry *dst = sk->sk_rx_dst;
1712 struct inet_sock *icsk = inet_sk(sk); 1710
1713 if (dst) 1711 if (dst)
1714 dst = dst_check(dst, 0); 1712 dst = dst_check(dst, 0);
1715 if (dst && 1713 if (dst &&
1716 icsk->rx_dst_ifindex == skb->skb_iif) 1714 inet_sk(sk)->rx_dst_ifindex == skb->skb_iif)
1717 skb_dst_set_noref(skb, dst); 1715 skb_dst_set_noref(skb, dst);
1718 } 1716 }
1719 } 1717 }
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 5912ac3fd240..3f1cc2028edd 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -388,6 +388,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
388 struct tcp_cookie_values *oldcvp = oldtp->cookie_values; 388 struct tcp_cookie_values *oldcvp = oldtp->cookie_values;
389 389
390 newsk->sk_rx_dst = dst_clone(skb_dst(skb)); 390 newsk->sk_rx_dst = dst_clone(skb_dst(skb));
391 inet_sk(newsk)->rx_dst_ifindex = skb->skb_iif;
391 392
392 /* TCP Cookie Transactions require space for the cookie pair, 393 /* TCP Cookie Transactions require space for the cookie pair,
393 * as it differs for each connection. There is no need to 394 * as it differs for each connection. There is no need to