aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sm_statefuns.c
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2009-08-21 23:24:00 -0400
committerVlad Yasevich <vladislav.yasevich@hp.com>2009-09-04 18:20:57 -0400
commita2f36eec5647548fa94fb68e2843b00fb9c0d46b (patch)
tree2f9927736f20817bdaed1d1f8a897af2c1e0d605 /net/sctp/sm_statefuns.c
parent9c5c62be2f794c7cee533d856f9f34c3cf21ff1b (diff)
sctp: drop SHUTDOWN chunk if the TSN is less than the CTSN
If Cumulative TSN Ack field of SHUTDOWN chunk is less than the Cumulative TSN Ack Point then drop the SHUTDOWN chunk. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/sm_statefuns.c')
-rw-r--r--net/sctp/sm_statefuns.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 910926906a3a..73bdeb2b6c62 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -2570,6 +2570,12 @@ sctp_disposition_t sctp_sf_do_9_2_shutdown(const struct sctp_endpoint *ep,
2570 chunk->subh.shutdown_hdr = sdh; 2570 chunk->subh.shutdown_hdr = sdh;
2571 ctsn = ntohl(sdh->cum_tsn_ack); 2571 ctsn = ntohl(sdh->cum_tsn_ack);
2572 2572
2573 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) {
2574 SCTP_DEBUG_PRINTK("ctsn %x\n", ctsn);
2575 SCTP_DEBUG_PRINTK("ctsn_ack_point %x\n", asoc->ctsn_ack_point);
2576 return SCTP_DISPOSITION_DISCARD;
2577 }
2578
2573 /* If Cumulative TSN Ack beyond the max tsn currently 2579 /* If Cumulative TSN Ack beyond the max tsn currently
2574 * send, terminating the association and respond to the 2580 * send, terminating the association and respond to the
2575 * sender with an ABORT. 2581 * sender with an ABORT.
@@ -2633,6 +2639,7 @@ sctp_disposition_t sctp_sf_do_9_2_shut_ctsn(const struct sctp_endpoint *ep,
2633{ 2639{
2634 struct sctp_chunk *chunk = arg; 2640 struct sctp_chunk *chunk = arg;
2635 sctp_shutdownhdr_t *sdh; 2641 sctp_shutdownhdr_t *sdh;
2642 __u32 ctsn;
2636 2643
2637 if (!sctp_vtag_verify(chunk, asoc)) 2644 if (!sctp_vtag_verify(chunk, asoc))
2638 return sctp_sf_pdiscard(ep, asoc, type, arg, commands); 2645 return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -2644,12 +2651,19 @@ sctp_disposition_t sctp_sf_do_9_2_shut_ctsn(const struct sctp_endpoint *ep,
2644 commands); 2651 commands);
2645 2652
2646 sdh = (sctp_shutdownhdr_t *)chunk->skb->data; 2653 sdh = (sctp_shutdownhdr_t *)chunk->skb->data;
2654 ctsn = ntohl(sdh->cum_tsn_ack);
2655
2656 if (TSN_lt(ctsn, asoc->ctsn_ack_point)) {
2657 SCTP_DEBUG_PRINTK("ctsn %x\n", ctsn);
2658 SCTP_DEBUG_PRINTK("ctsn_ack_point %x\n", asoc->ctsn_ack_point);
2659 return SCTP_DISPOSITION_DISCARD;
2660 }
2647 2661
2648 /* If Cumulative TSN Ack beyond the max tsn currently 2662 /* If Cumulative TSN Ack beyond the max tsn currently
2649 * send, terminating the association and respond to the 2663 * send, terminating the association and respond to the
2650 * sender with an ABORT. 2664 * sender with an ABORT.
2651 */ 2665 */
2652 if (!TSN_lt(ntohl(sdh->cum_tsn_ack), asoc->next_tsn)) 2666 if (!TSN_lt(ctsn, asoc->next_tsn))
2653 return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands); 2667 return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands);
2654 2668
2655 /* verify, by checking the Cumulative TSN Ack field of the 2669 /* verify, by checking the Cumulative TSN Ack field of the