diff options
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r-- | net/dccp/dccp.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index f9ed0cbd1bf3..e4d6e76ced41 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -415,6 +415,23 @@ static inline void dccp_update_gsr(struct sock *sk, u64 seq) | |||
415 | dp->dccps_gsr = seq; | 415 | dp->dccps_gsr = seq; |
416 | /* Sequence validity window depends on remote Sequence Window (7.5.1) */ | 416 | /* Sequence validity window depends on remote Sequence Window (7.5.1) */ |
417 | dp->dccps_swl = SUB48(ADD48(dp->dccps_gsr, 1), dp->dccps_r_seq_win / 4); | 417 | dp->dccps_swl = SUB48(ADD48(dp->dccps_gsr, 1), dp->dccps_r_seq_win / 4); |
418 | /* | ||
419 | * Adjust SWL so that it is not below ISR. In contrast to RFC 4340, | ||
420 | * 7.5.1 we perform this check beyond the initial handshake: W/W' are | ||
421 | * always > 32, so for the first W/W' packets in the lifetime of a | ||
422 | * connection we always have to adjust SWL. | ||
423 | * A second reason why we are doing this is that the window depends on | ||
424 | * the feature-remote value of Sequence Window: nothing stops the peer | ||
425 | * from updating this value while we are busy adjusting SWL for the | ||
426 | * first W packets (we would have to count from scratch again then). | ||
427 | * Therefore it is safer to always make sure that the Sequence Window | ||
428 | * is not artificially extended by a peer who grows SWL downwards by | ||
429 | * continually updating the feature-remote Sequence-Window. | ||
430 | * If sequence numbers wrap it is bad luck. But that will take a while | ||
431 | * (48 bit), and this measure prevents Sequence-number attacks. | ||
432 | */ | ||
433 | if (before48(dp->dccps_swl, dp->dccps_isr)) | ||
434 | dp->dccps_swl = dp->dccps_isr; | ||
418 | dp->dccps_swh = ADD48(dp->dccps_gsr, (3 * dp->dccps_r_seq_win) / 4); | 435 | dp->dccps_swh = ADD48(dp->dccps_gsr, (3 * dp->dccps_r_seq_win) / 4); |
419 | } | 436 | } |
420 | 437 | ||
@@ -425,6 +442,9 @@ static inline void dccp_update_gss(struct sock *sk, u64 seq) | |||
425 | dp->dccps_gss = seq; | 442 | dp->dccps_gss = seq; |
426 | /* Ack validity window depends on local Sequence Window value (7.5.1) */ | 443 | /* Ack validity window depends on local Sequence Window value (7.5.1) */ |
427 | dp->dccps_awl = SUB48(ADD48(dp->dccps_gss, 1), dp->dccps_l_seq_win); | 444 | dp->dccps_awl = SUB48(ADD48(dp->dccps_gss, 1), dp->dccps_l_seq_win); |
445 | /* Adjust AWL so that it is not below ISS - see comment above for SWL */ | ||
446 | if (before48(dp->dccps_awl, dp->dccps_iss)) | ||
447 | dp->dccps_awl = dp->dccps_iss; | ||
428 | dp->dccps_awh = dp->dccps_gss; | 448 | dp->dccps_awh = dp->dccps_gss; |
429 | } | 449 | } |
430 | 450 | ||