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.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 0ae0311082fb..ecdbb9f46541 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -82,6 +82,12 @@ static struct inet_connection_sock_af_ops ipv6_specific;
82#ifdef CONFIG_TCP_MD5SIG 82#ifdef CONFIG_TCP_MD5SIG
83static struct tcp_sock_af_ops tcp_sock_ipv6_specific; 83static struct tcp_sock_af_ops tcp_sock_ipv6_specific;
84static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; 84static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific;
85#else
86static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk,
87 struct in6_addr *addr)
88{
89 return NULL;
90}
85#endif 91#endif
86 92
87static void tcp_v6_hash(struct sock *sk) 93static void tcp_v6_hash(struct sock *sk)
@@ -1011,8 +1017,8 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
1011 kfree_skb(buff); 1017 kfree_skb(buff);
1012} 1018}
1013 1019
1014static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, 1020static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts,
1015 struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32 ts) 1021 struct tcp_md5sig_key *key)
1016{ 1022{
1017 struct tcphdr *th = tcp_hdr(skb), *t1; 1023 struct tcphdr *th = tcp_hdr(skb), *t1;
1018 struct sk_buff *buff; 1024 struct sk_buff *buff;
@@ -1021,22 +1027,6 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
1021 struct sock *ctl_sk = net->ipv6.tcp_sk; 1027 struct sock *ctl_sk = net->ipv6.tcp_sk;
1022 unsigned int tot_len = sizeof(struct tcphdr); 1028 unsigned int tot_len = sizeof(struct tcphdr);
1023 __be32 *topt; 1029 __be32 *topt;
1024#ifdef CONFIG_TCP_MD5SIG
1025 struct tcp_md5sig_key *key;
1026 struct tcp_md5sig_key tw_key;
1027#endif
1028
1029#ifdef CONFIG_TCP_MD5SIG
1030 if (!tw && skb->sk) {
1031 key = tcp_v6_md5_do_lookup(skb->sk, &ipv6_hdr(skb)->daddr);
1032 } else if (tw && tw->tw_md5_keylen) {
1033 tw_key.key = tw->tw_md5_key;
1034 tw_key.keylen = tw->tw_md5_keylen;
1035 key = &tw_key;
1036 } else {
1037 key = NULL;
1038 }
1039#endif
1040 1030
1041 if (ts) 1031 if (ts)
1042 tot_len += TCPOLEN_TSTAMP_ALIGNED; 1032 tot_len += TCPOLEN_TSTAMP_ALIGNED;
@@ -1116,16 +1106,17 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb)
1116 struct inet_timewait_sock *tw = inet_twsk(sk); 1106 struct inet_timewait_sock *tw = inet_twsk(sk);
1117 struct tcp_timewait_sock *tcptw = tcp_twsk(sk); 1107 struct tcp_timewait_sock *tcptw = tcp_twsk(sk);
1118 1108
1119 tcp_v6_send_ack(tcptw, skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, 1109 tcp_v6_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt,
1120 tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, 1110 tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale,
1121 tcptw->tw_ts_recent); 1111 tcptw->tw_ts_recent, tcp_twsk_md5_key(tcptw));
1122 1112
1123 inet_twsk_put(tw); 1113 inet_twsk_put(tw);
1124} 1114}
1125 1115
1126static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req) 1116static void tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req)
1127{ 1117{
1128 tcp_v6_send_ack(NULL, skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent); 1118 tcp_v6_send_ack(skb, tcp_rsk(req)->snt_isn + 1, tcp_rsk(req)->rcv_isn + 1, req->rcv_wnd, req->ts_recent,
1119 tcp_v6_md5_do_lookup(skb->sk, &ipv6_hdr(skb)->daddr));
1129} 1120}
1130 1121
1131 1122