MCPcopy Create free account
hub / github.com/F-Stack/f-stack / process_chunk_drop

Function process_chunk_drop

freebsd/netinet/sctp_input.c:3092–3328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3090}
3091
3092static int
3093process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc,
3094 struct sctp_nets *net, uint8_t flg)
3095{
3096 switch (desc->chunk_type) {
3097 case SCTP_DATA:
3098 case SCTP_IDATA:
3099 /* find the tsn to resend (possibly) */
3100 {
3101 uint32_t tsn;
3102 struct sctp_tmit_chunk *tp1;
3103
3104 tsn = ntohl(desc->tsn_ifany);
3105 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) {
3106 if (tp1->rec.data.tsn == tsn) {
3107 /* found it */
3108 break;
3109 }
3110 if (SCTP_TSN_GT(tp1->rec.data.tsn, tsn)) {
3111 /* not found */
3112 tp1 = NULL;
3113 break;
3114 }
3115 }
3116 if (tp1 == NULL) {
3117 /*
3118 * Do it the other way , aka without paying
3119 * attention to queue seq order.
3120 */
3121 SCTP_STAT_INCR(sctps_pdrpdnfnd);
3122 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) {
3123 if (tp1->rec.data.tsn == tsn) {
3124 /* found it */
3125 break;
3126 }
3127 }
3128 }
3129 if (tp1 == NULL) {
3130 SCTP_STAT_INCR(sctps_pdrptsnnf);
3131 }
3132 if ((tp1) && (tp1->sent < SCTP_DATAGRAM_ACKED)) {
3133 if (((flg & SCTP_BADCRC) == 0) &&
3134 ((flg & SCTP_FROM_MIDDLE_BOX) == 0)) {
3135 return (0);
3136 }
3137 if ((stcb->asoc.peers_rwnd == 0) &&
3138 ((flg & SCTP_FROM_MIDDLE_BOX) == 0)) {
3139 SCTP_STAT_INCR(sctps_pdrpdiwnp);
3140 return (0);
3141 }
3142 if (stcb->asoc.peers_rwnd == 0 &&
3143 (flg & SCTP_FROM_MIDDLE_BOX)) {
3144 SCTP_STAT_INCR(sctps_pdrpdizrw);
3145 return (0);
3146 }
3147 if ((uint32_t)SCTP_BUF_LEN(tp1->data) <
3148 SCTP_DATA_CHUNK_OVERHEAD(stcb) + SCTP_NUM_DB_TO_VERIFY) {
3149 /* Payload not matching. */

Callers 1

Calls 12

sctp_timer_stopFunction · 0.85
sctp_timer_startFunction · 0.85
sctp_misc_intsFunction · 0.85
sctp_send_initiateFunction · 0.85
sctp_send_sackFunction · 0.85
sctp_send_hbFunction · 0.85
sctp_send_shutdownFunction · 0.85
sctp_send_shutdown_ackFunction · 0.85
sctp_send_cookie_ackFunction · 0.85
sctp_send_asconf_ackFunction · 0.85
send_forward_tsnFunction · 0.85

Tested by

no test coverage detected