Author: rrs
Date: Mon Jul 26 09:22:52 2010
New Revision: 210494
URL: http://svn.freebsd.org/changeset/base/210494

Log:
  Make sure that we report chunks if a socket
  still exists that were not sent. In either
  case carefully remove the data if it does not
  get taken by the reporting routines.
  
  MFC after:    2 weeks

Modified:
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c Mon Jul 26 09:20:55 2010        (r210493)
+++ head/sys/netinet/sctp_pcb.c Mon Jul 26 09:22:52 2010        (r210494)
@@ -4830,9 +4830,17 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
                while (sp) {
                        TAILQ_REMOVE(&outs->outqueue, sp, next);
                        if (sp->data) {
-                               sctp_m_freem(sp->data);
-                               sp->data = NULL;
-                               sp->tail_mbuf = NULL;
+                               if (so) {
+                                       /* Still an open socket - report */
+                                       
sctp_ulp_notify(SCTP_NOTIFY_SPECIAL_SP_FAIL, stcb,
+                                           SCTP_NOTIFY_DATAGRAM_UNSENT,
+                                           (void *)sp, 0);
+                               }
+                               if (sp->data) {
+                                       sctp_m_freem(sp->data);
+                                       sp->data = NULL;
+                                       sp->tail_mbuf = NULL;
+                               }
                        }
                        sctp_free_remote_addr(sp->net);
                        sctp_free_spbufspace(stcb, asoc, sp);
@@ -4892,8 +4900,15 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
                while (chk) {
                        TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
                        if (chk->data) {
-                               sctp_m_freem(chk->data);
-                               chk->data = NULL;
+                               if (so) {
+                                       /* Still a socket? */
+                                       sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, 
stcb,
+                                           SCTP_NOTIFY_DATAGRAM_UNSENT, chk, 
0);
+                               }
+                               if (chk->data) {
+                                       sctp_m_freem(chk->data);
+                                       chk->data = NULL;
+                               }
                        }
                        if (chk->holds_key_ref)
                                sctp_auth_key_release(stcb, chk->auth_keyid);
@@ -4917,8 +4932,15 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
                while (chk) {
                        TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
                        if (chk->data) {
-                               sctp_m_freem(chk->data);
-                               chk->data = NULL;
+                               if (so) {
+                                       /* Still a socket? */
+                                       sctp_ulp_notify(SCTP_NOTIFY_DG_FAIL, 
stcb,
+                                           SCTP_NOTIFY_DATAGRAM_SENT, chk, 0);
+                               }
+                               if (chk->data) {
+                                       sctp_m_freem(chk->data);
+                                       chk->data = NULL;
+                               }
                        }
                        if (chk->holds_key_ref)
                                sctp_auth_key_release(stcb, chk->auth_keyid);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to