summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2007-06-17 01:36:02 +0000
committerrrs <rrs@FreeBSD.org>2007-06-17 01:36:02 +0000
commita50eb788faabaf4a93e82cc35cc09d3db96c9539 (patch)
tree4021851b081dca4e0a547aaf328fad5ba03e3112 /sys
parent6a4276ae14305505c7daf6c5c38cf89b26e623a6 (diff)
downloadFreeBSD-src-a50eb788faabaf4a93e82cc35cc09d3db96c9539.zip
FreeBSD-src-a50eb788faabaf4a93e82cc35cc09d3db96c9539.tar.gz
- 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).
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/sctp_input.c2
-rw-r--r--sys/netinet/sctp_output.c7
-rw-r--r--sys/netinet/sctp_pcb.c6
-rw-r--r--sys/netinet6/sctp6_usrreq.c3
4 files changed, 10 insertions, 8 deletions
diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c
index f10507f..42303ab 100644
--- a/sys/netinet/sctp_input.c
+++ b/sys/netinet/sctp_input.c
@@ -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))) {
diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c
index cb8b93f..430f853 100644
--- a/sys/netinet/sctp_output.c
+++ b/sys/netinet/sctp_output.c
@@ -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;
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index d5d5ffd..66b037e 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -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 */
diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c
index 190a5e9..92c23f7 100644
--- a/sys/netinet6/sctp6_usrreq.c
+++ b/sys/netinet6/sctp6_usrreq.c
@@ -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
OpenPOWER on IntegriCloud