- For sctp_input/sctp6_input add announcment when a packet arrives (debug)

- re-factor the packet drop in sctp_output a bit more, we don't need the
   trim after all, but the size calc is now corrected.
 - When a assoc is in the COOKIE-ECHO/COOKIE-WAIT state and the user
   closes, it should not matter if data is queued, the assoc should be
   purged.
 - In error leg a missing free_chunk when iph comes in NULL (should not
   happen but just in case).
This commit is contained in:
rrs 2007-06-17 01:36:02 +00:00
parent 6a4276ae14
commit a50eb788fa
4 changed files with 10 additions and 8 deletions

View File

@ -4737,6 +4737,8 @@ sctp_input(i_pak, off)
}
sh = (struct sctphdr *)((caddr_t)ip + iphlen);
ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(*sh));
SCTPDBG(SCTP_DEBUG_INPUT1,
"sctp_input() length:%d iphlen:%d\n", mlen, iphlen);
/* SCTP does not allow broadcasts or multicasts */
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {

View File

@ -9653,7 +9653,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
int len;
int was_trunc = 0;
struct ip *iph;
int fullsz = 0, trimby = 0;
int fullsz = 0, extra = 0;
long spc;
asoc = &stcb->asoc;
@ -9674,6 +9674,7 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
chk->copy_by_ref = 0;
iph = mtod(m, struct ip *);
if (iph == NULL) {
sctp_free_a_chunk(stcb, chk);
return;
}
if (iph->ip_v == IPVERSION) {
@ -9691,10 +9692,8 @@ sctp_send_packet_dropped(struct sctp_tcb *stcb, struct sctp_nets *net,
/*
* only send 1 mtu worth, trim off the excess on the end.
*/
fullsz = len + SCTP_MAX_OVERHEAD;
fullsz = len - extra;
len = min(stcb->asoc.smallest_mtu, MCLBYTES) - SCTP_MAX_OVERHEAD;
trimby = len - fullsz;
m_adj(m, trimby);
was_trunc = 1;
}
chk->asoc = &stcb->asoc;

View File

@ -2560,10 +2560,8 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from)
if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_COOKIE_WAIT) ||
(SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_COOKIE_ECHOED)) {
/* Just abandon things in the front states */
if (asoc->asoc.total_output_queue_size == 0) {
sctp_free_assoc(inp, asoc, SCTP_PCBFREE_NOFORCE, SCTP_FROM_SCTP_PCB + SCTP_LOC_2);
continue;
}
sctp_free_assoc(inp, asoc, SCTP_PCBFREE_NOFORCE, SCTP_FROM_SCTP_PCB + SCTP_LOC_2);
continue;
}
SCTP_TCB_LOCK(asoc);
/* Disconnect the socket please */

View File

@ -102,6 +102,9 @@ sctp6_input(i_pak, offp, proto)
ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr));
iphlen = off;
offset = iphlen + sizeof(*sh) + sizeof(*ch);
SCTPDBG(SCTP_DEBUG_INPUT1,
"sctp6_input() length:%d iphlen:%d\n", pkt_len, iphlen);
#if defined(NFAITH) && NFAITH > 0