diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2007-08-30 14:10:59 -0400 |
---|---|---|
committer | Vlad Yasevich <vladislav.yasevich@hp.com> | 2007-08-30 14:12:25 -0400 |
commit | 609ee4679b8a0831257552dd2b0e54f509ba0c77 (patch) | |
tree | 2a7a4bc4848de6fb6b0bd502e358f2893cfe71d3 /net/sctp | |
parent | 498d63071ef378e201979e441aefcc6565702ca7 (diff) |
SCTP: Abort on COOKIE-ECHO if backlog is exceeded.
Currently we abort on the INIT chunk we our backlog is currenlty
exceeded. Delay this about untill COOKIE-ECHO to give the user
time to accept the socket. Also, make sure that we treat
sk_max_backlog of 0 as no connections allowed.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/sm_statefuns.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 276e26d3d7da..177528ed3e1b 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -264,7 +264,6 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep, | |||
264 | struct sctp_chunk *err_chunk; | 264 | struct sctp_chunk *err_chunk; |
265 | struct sctp_packet *packet; | 265 | struct sctp_packet *packet; |
266 | sctp_unrecognized_param_t *unk_param; | 266 | sctp_unrecognized_param_t *unk_param; |
267 | struct sock *sk; | ||
268 | int len; | 267 | int len; |
269 | 268 | ||
270 | /* 6.10 Bundling | 269 | /* 6.10 Bundling |
@@ -285,16 +284,6 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep, | |||
285 | if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) | 284 | if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) |
286 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); | 285 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); |
287 | 286 | ||
288 | sk = ep->base.sk; | ||
289 | /* If the endpoint is not listening or if the number of associations | ||
290 | * on the TCP-style socket exceed the max backlog, respond with an | ||
291 | * ABORT. | ||
292 | */ | ||
293 | if (!sctp_sstate(sk, LISTENING) || | ||
294 | (sctp_style(sk, TCP) && | ||
295 | sk_acceptq_is_full(sk))) | ||
296 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); | ||
297 | |||
298 | /* 3.1 A packet containing an INIT chunk MUST have a zero Verification | 287 | /* 3.1 A packet containing an INIT chunk MUST have a zero Verification |
299 | * Tag. | 288 | * Tag. |
300 | */ | 289 | */ |
@@ -590,6 +579,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, | |||
590 | struct sctp_ulpevent *ev, *ai_ev = NULL; | 579 | struct sctp_ulpevent *ev, *ai_ev = NULL; |
591 | int error = 0; | 580 | int error = 0; |
592 | struct sctp_chunk *err_chk_p; | 581 | struct sctp_chunk *err_chk_p; |
582 | struct sock *sk; | ||
593 | 583 | ||
594 | /* If the packet is an OOTB packet which is temporarily on the | 584 | /* If the packet is an OOTB packet which is temporarily on the |
595 | * control endpoint, respond with an ABORT. | 585 | * control endpoint, respond with an ABORT. |
@@ -605,6 +595,15 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep, | |||
605 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 595 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) |
606 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); | 596 | return sctp_sf_pdiscard(ep, asoc, type, arg, commands); |
607 | 597 | ||
598 | /* If the endpoint is not listening or if the number of associations | ||
599 | * on the TCP-style socket exceed the max backlog, respond with an | ||
600 | * ABORT. | ||
601 | */ | ||
602 | sk = ep->base.sk; | ||
603 | if (!sctp_sstate(sk, LISTENING) || | ||
604 | (sctp_style(sk, TCP) && sk_acceptq_is_full(sk))) | ||
605 | return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); | ||
606 | |||
608 | /* "Decode" the chunk. We have no optional parameters so we | 607 | /* "Decode" the chunk. We have no optional parameters so we |
609 | * are in good shape. | 608 | * are in good shape. |
610 | */ | 609 | */ |