Skip to content

Commit 73f18fd

Browse files
author
Gerrit Renker
committed
dccp: Bug-Fix - AWL was never updated
The AWL lower Ack validity window advances in proportion to GSS, the greatest sequence number sent. Updating AWL other than at connection setup (in the DCCP-Request sent by dccp_v{4,6}_connect()) was missing in the DCCP code. This bug lead to syslog messages such as "kernel: dccp_check_seqno: DCCP: Step 6 failed for DATAACK packet, [...] P.ackno exists or LAWL(82947089) <= P.ackno(82948208) <= S.AWH(82948728), sending SYNC..." The difference between AWL/AWH here is 1639 packets, while the expected value (the Sequence Window) would have been 100 (the default). A closer look showed that LAWL = AWL = 82947089 equalled the ISS on the Response. The patch now updates AWL with each increase of GSS. Further changes: ---------------- The patch also enforces more stringent checks on the ISS sequence number: * AWL is initialised to ISS at connection setup and remains at this value; * AWH is then always set to GSS (via dccp_update_gss()); * so on the first Request: AWL = AWH = ISS, and on the n-th Request: AWL = ISS, AWH = ISS + n. As a consequence, only Response packets that refer to Requests sent by this host will pass, all others are discarded. This is the intention and in effect implements the initial adjustments for AWL as specified in RFC 4340, 7.5.1. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
1 parent 5943544 commit 73f18fd

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

‎net/dccp/output.c‎

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
5353
dccp_packet_hdr_len(dcb->dccpd_type);
5454
int err, set_ack = 1;
5555
u64 ackno = dp->dccps_gsr;
56-
57-
dccp_inc_seqno(&dp->dccps_gss);
56+
/*
57+
* Increment GSS here already in case the option code needs it.
58+
* Update GSS for real only if option processing below succeeds.
59+
*/
60+
dcb->dccpd_seq = ADD48(dp->dccps_gss, 1);
5861

5962
switch (dcb->dccpd_type) {
6063
case DCCP_PKT_DATA:
@@ -66,6 +69,9 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
6669

6770
case DCCP_PKT_REQUEST:
6871
set_ack = 0;
72+
/* Use ISS on the first (non-retransmitted) Request. */
73+
if (icsk->icsk_retransmits == 0)
74+
dcb->dccpd_seq = dp->dccps_iss;
6975
/* fall through */
7076

7177
case DCCP_PKT_SYNC:
@@ -84,8 +90,6 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
8490
break;
8591
}
8692

87-
dcb->dccpd_seq = dp->dccps_gss;
88-
8993
if (dccp_insert_options(sk, skb)) {
9094
kfree_skb(skb);
9195
return -EPROTO;
@@ -103,7 +107,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
103107
/* XXX For now we're using only 48 bits sequence numbers */
104108
dh->dccph_x = 1;
105109

106-
dp->dccps_awh = dp->dccps_gss;
110+
dccp_update_gss(sk, dcb->dccpd_seq);
107111
dccp_hdr_set_seq(dh, dp->dccps_gss);
108112
if (set_ack)
109113
dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), ackno);
@@ -112,6 +116,11 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
112116
case DCCP_PKT_REQUEST:
113117
dccp_hdr_request(skb)->dccph_req_service =
114118
dp->dccps_service;
119+
/*
120+
* Limit Ack window to ISS <= P.ackno <= GSS, so that
121+
* only Responses to Requests we sent are considered.
122+
*/
123+
dp->dccps_awl = dp->dccps_iss;
115124
break;
116125
case DCCP_PKT_RESET:
117126
dccp_hdr_reset(skb)->dccph_reset_code =
@@ -449,19 +458,7 @@ static inline void dccp_connect_init(struct sock *sk)
449458

450459
dccp_sync_mss(sk, dst_mtu(dst));
451460

452-
/*
453-
* SWL and AWL are initially adjusted so that they are not less than
454-
* the initial Sequence Numbers received and sent, respectively:
455-
* SWL := max(GSR + 1 - floor(W/4), ISR),
456-
* AWL := max(GSS - W' + 1, ISS).
457-
* These adjustments MUST be applied only at the beginning of the
458-
* connection.
459-
*/
460-
dccp_update_gss(sk, dp->dccps_iss);
461-
dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss));
462-
463-
/* S.GAR - greatest valid acknowledgement number received on a non-Sync;
464-
* initialized to S.ISS (sec. 8.5) */
461+
/* Initialise GAR as per 8.5; AWL/AWH are set in dccp_transmit_skb() */
465462
dp->dccps_gar = dp->dccps_iss;
466463

467464
icsk->icsk_retransmits = 0;

0 commit comments

Comments
 (0)