aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/input.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 3b651701cfe4..6276b23fc204 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -68,7 +68,8 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
68{ 68{
69 const struct dccp_hdr *dh = dccp_hdr(skb); 69 const struct dccp_hdr *dh = dccp_hdr(skb);
70 struct dccp_sock *dp = dccp_sk(sk); 70 struct dccp_sock *dp = dccp_sk(sk);
71 u64 lswl, lawl; 71 u64 lswl, lawl, seqno = DCCP_SKB_CB(skb)->dccpd_seq,
72 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq;
72 73
73 /* 74 /*
74 * Step 5: Prepare sequence numbers for Sync 75 * Step 5: Prepare sequence numbers for Sync
@@ -84,11 +85,9 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
84 */ 85 */
85 if (dh->dccph_type == DCCP_PKT_SYNC || 86 if (dh->dccph_type == DCCP_PKT_SYNC ||
86 dh->dccph_type == DCCP_PKT_SYNCACK) { 87 dh->dccph_type == DCCP_PKT_SYNCACK) {
87 if (between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, 88 if (between48(ackno, dp->dccps_awl, dp->dccps_awh) &&
88 dp->dccps_awl, dp->dccps_awh) && 89 dccp_delta_seqno(dp->dccps_swl, seqno) >= 0)
89 dccp_delta_seqno(dp->dccps_swl, 90 dccp_update_gsr(sk, seqno);
90 DCCP_SKB_CB(skb)->dccpd_seq) >= 0)
91 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
92 else 91 else
93 return -1; 92 return -1;
94 } 93 }
@@ -113,35 +112,30 @@ static int dccp_check_seqno(struct sock *sk, struct sk_buff *skb)
113 if (dh->dccph_type == DCCP_PKT_CLOSEREQ || 112 if (dh->dccph_type == DCCP_PKT_CLOSEREQ ||
114 dh->dccph_type == DCCP_PKT_CLOSE || 113 dh->dccph_type == DCCP_PKT_CLOSE ||
115 dh->dccph_type == DCCP_PKT_RESET) { 114 dh->dccph_type == DCCP_PKT_RESET) {
116 lswl = dp->dccps_gsr; 115 lswl = ADD48(dp->dccps_gsr, 1);
117 dccp_inc_seqno(&lswl);
118 lawl = dp->dccps_gar; 116 lawl = dp->dccps_gar;
119 } 117 }
120 118
121 if (between48(DCCP_SKB_CB(skb)->dccpd_seq, lswl, dp->dccps_swh) && 119 if (between48(seqno, lswl, dp->dccps_swh) &&
122 (DCCP_SKB_CB(skb)->dccpd_ack_seq == DCCP_PKT_WITHOUT_ACK_SEQ || 120 (ackno == DCCP_PKT_WITHOUT_ACK_SEQ ||
123 between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, 121 between48(ackno, lawl, dp->dccps_awh))) {
124 lawl, dp->dccps_awh))) { 122 dccp_update_gsr(sk, seqno);
125 dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq);
126 123
127 if (dh->dccph_type != DCCP_PKT_SYNC && 124 if (dh->dccph_type != DCCP_PKT_SYNC &&
128 (DCCP_SKB_CB(skb)->dccpd_ack_seq != 125 (ackno != DCCP_PKT_WITHOUT_ACK_SEQ))
129 DCCP_PKT_WITHOUT_ACK_SEQ)) 126 dp->dccps_gar = ackno;
130 dp->dccps_gar = DCCP_SKB_CB(skb)->dccpd_ack_seq;
131 } else { 127 } else {
132 DCCP_WARN("DCCP: Step 6 failed for %s packet, " 128 DCCP_WARN("DCCP: Step 6 failed for %s packet, "
133 "(LSWL(%llu) <= P.seqno(%llu) <= S.SWH(%llu)) and " 129 "(LSWL(%llu) <= P.seqno(%llu) <= S.SWH(%llu)) and "
134 "(P.ackno %s or LAWL(%llu) <= P.ackno(%llu) <= S.AWH(%llu), " 130 "(P.ackno %s or LAWL(%llu) <= P.ackno(%llu) <= S.AWH(%llu), "
135 "sending SYNC...\n", dccp_packet_name(dh->dccph_type), 131 "sending SYNC...\n", dccp_packet_name(dh->dccph_type),
136 (unsigned long long) lswl, 132 (unsigned long long) lswl, (unsigned long long) seqno,
137 (unsigned long long) DCCP_SKB_CB(skb)->dccpd_seq,
138 (unsigned long long) dp->dccps_swh, 133 (unsigned long long) dp->dccps_swh,
139 (DCCP_SKB_CB(skb)->dccpd_ack_seq == 134 (ackno == DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist"
140 DCCP_PKT_WITHOUT_ACK_SEQ) ? "doesn't exist" : "exists", 135 : "exists",
141 (unsigned long long) lawl, 136 (unsigned long long) lawl, (unsigned long long) ackno,
142 (unsigned long long) DCCP_SKB_CB(skb)->dccpd_ack_seq,
143 (unsigned long long) dp->dccps_awh); 137 (unsigned long long) dp->dccps_awh);
144 dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC); 138 dccp_send_sync(sk, seqno, DCCP_PKT_SYNC);
145 return -1; 139 return -1;
146 } 140 }
147 141