aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 64d94afa427f..1f04ec0e4a7a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -69,6 +69,8 @@
69#include <crypto/hash.h> 69#include <crypto/hash.h>
70#include <linux/scatterlist.h> 70#include <linux/scatterlist.h>
71 71
72#include <trace/events/tcp.h>
73
72static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb); 74static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb);
73static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb, 75static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
74 struct request_sock *req); 76 struct request_sock *req);
@@ -890,7 +892,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
890 int genhash; 892 int genhash;
891 struct sock *sk1 = NULL; 893 struct sock *sk1 = NULL;
892#endif 894#endif
893 int oif; 895 int oif = 0;
894 896
895 if (th->rst) 897 if (th->rst)
896 return; 898 return;
@@ -939,7 +941,11 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
939 ack_seq = ntohl(th->seq) + th->syn + th->fin + skb->len - 941 ack_seq = ntohl(th->seq) + th->syn + th->fin + skb->len -
940 (th->doff << 2); 942 (th->doff << 2);
941 943
942 oif = sk ? sk->sk_bound_dev_if : 0; 944 if (sk) {
945 oif = sk->sk_bound_dev_if;
946 trace_tcp_send_reset(sk, skb);
947 }
948
943 tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0, 0); 949 tcp_v6_send_response(sk, skb, seq, ack_seq, 0, 0, 0, oif, key, 1, 0, 0);
944 950
945#ifdef CONFIG_TCP_MD5SIG 951#ifdef CONFIG_TCP_MD5SIG
@@ -1448,7 +1454,6 @@ process:
1448 struct sock *nsk; 1454 struct sock *nsk;
1449 1455
1450 sk = req->rsk_listener; 1456 sk = req->rsk_listener;
1451 tcp_v6_fill_cb(skb, hdr, th);
1452 if (tcp_v6_inbound_md5_hash(sk, skb)) { 1457 if (tcp_v6_inbound_md5_hash(sk, skb)) {
1453 sk_drops_add(sk, skb); 1458 sk_drops_add(sk, skb);
1454 reqsk_put(req); 1459 reqsk_put(req);
@@ -1461,8 +1466,12 @@ process:
1461 sock_hold(sk); 1466 sock_hold(sk);
1462 refcounted = true; 1467 refcounted = true;
1463 nsk = NULL; 1468 nsk = NULL;
1464 if (!tcp_filter(sk, skb)) 1469 if (!tcp_filter(sk, skb)) {
1470 th = (const struct tcphdr *)skb->data;
1471 hdr = ipv6_hdr(skb);
1472 tcp_v6_fill_cb(skb, hdr, th);
1465 nsk = tcp_check_req(sk, skb, req, false); 1473 nsk = tcp_check_req(sk, skb, req, false);
1474 }
1466 if (!nsk) { 1475 if (!nsk) {
1467 reqsk_put(req); 1476 reqsk_put(req);
1468 goto discard_and_relse; 1477 goto discard_and_relse;
@@ -1486,8 +1495,6 @@ process:
1486 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) 1495 if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
1487 goto discard_and_relse; 1496 goto discard_and_relse;
1488 1497
1489 tcp_v6_fill_cb(skb, hdr, th);
1490
1491 if (tcp_v6_inbound_md5_hash(sk, skb)) 1498 if (tcp_v6_inbound_md5_hash(sk, skb))
1492 goto discard_and_relse; 1499 goto discard_and_relse;
1493 1500
@@ -1495,6 +1502,7 @@ process:
1495 goto discard_and_relse; 1502 goto discard_and_relse;
1496 th = (const struct tcphdr *)skb->data; 1503 th = (const struct tcphdr *)skb->data;
1497 hdr = ipv6_hdr(skb); 1504 hdr = ipv6_hdr(skb);
1505 tcp_v6_fill_cb(skb, hdr, th);
1498 1506
1499 skb->dev = NULL; 1507 skb->dev = NULL;
1500 1508
@@ -1577,13 +1585,13 @@ do_time_wait:
1577 refcounted = false; 1585 refcounted = false;
1578 goto process; 1586 goto process;
1579 } 1587 }
1580 /* Fall through to ACK */
1581 } 1588 }
1589 /* to ACK */
1590 /* fall through */
1582 case TCP_TW_ACK: 1591 case TCP_TW_ACK:
1583 tcp_v6_timewait_ack(sk, skb); 1592 tcp_v6_timewait_ack(sk, skb);
1584 break; 1593 break;
1585 case TCP_TW_RST: 1594 case TCP_TW_RST:
1586 tcp_v6_restore_cb(skb);
1587 tcp_v6_send_reset(sk, skb); 1595 tcp_v6_send_reset(sk, skb);
1588 inet_twsk_deschedule_put(inet_twsk(sk)); 1596 inet_twsk_deschedule_put(inet_twsk(sk));
1589 goto discard_it; 1597 goto discard_it;
@@ -1933,8 +1941,8 @@ struct proto tcpv6_prot = {
1933 .memory_pressure = &tcp_memory_pressure, 1941 .memory_pressure = &tcp_memory_pressure,
1934 .orphan_count = &tcp_orphan_count, 1942 .orphan_count = &tcp_orphan_count,
1935 .sysctl_mem = sysctl_tcp_mem, 1943 .sysctl_mem = sysctl_tcp_mem,
1936 .sysctl_wmem = sysctl_tcp_wmem, 1944 .sysctl_wmem_offset = offsetof(struct net, ipv4.sysctl_tcp_wmem),
1937 .sysctl_rmem = sysctl_tcp_rmem, 1945 .sysctl_rmem_offset = offsetof(struct net, ipv4.sysctl_tcp_rmem),
1938 .max_header = MAX_TCP_HEADER, 1946 .max_header = MAX_TCP_HEADER,
1939 .obj_size = sizeof(struct tcp6_sock), 1947 .obj_size = sizeof(struct tcp6_sock),
1940 .slab_flags = SLAB_TYPESAFE_BY_RCU, 1948 .slab_flags = SLAB_TYPESAFE_BY_RCU,