From 52be287ebb94f4beed456463067ae48289967ff8 Mon Sep 17 00:00:00 2001 From: Randall Stewart Date: Sat, 21 Jul 2007 21:41:32 +0000 Subject: - remove duplicate code from sctp_asconf.c - remove duplicate #include that is not under #ifdef FreeBSD version to allow compile on 6.1 - static analysis changes per the cisco SA tool including: o some SA_IGNORE comments o some checks for NULL before unlock. o type corrections int -> size_t - Fix it so sctp_alloc_asoc takes a thread/proc argument. Without this we pass a NULL in to bind on implicit assoc setup and crash :-( Approved by: re@freebsd.org(Ken Smith) --- sys/netinet/sctp_input.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sys/netinet/sctp_input.c') diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 0bf48bc676b2..c426cd6e1870 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -186,8 +186,8 @@ sctp_is_there_unsent_data(struct sctp_tcb *stcb) if (!TAILQ_EMPTY(&asoc->out_wheel)) { /* Check to see if some data queued */ TAILQ_FOREACH(strq, &asoc->out_wheel, next_spoke) { - /* sa_ignore FREED_MEMORY */ is_there_another: + /* sa_ignore FREED_MEMORY */ sp = TAILQ_FIRST(&strq->outqueue); if (sp == NULL) { continue; @@ -1620,8 +1620,17 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, * now that we know the INIT/INIT-ACK are in place, create a new TCB * and popluate */ + + /* + * Here we do a trick, we set in NULL for the proc/thread argument. + * We do this since in effect we only use the p argument when the + * socket is unbound and we must do an implicit bind. Since we are + * getting a cookie, we cannot be unbound. + */ stcb = sctp_aloc_assoc(inp, init_src, 0, &error, - ntohl(initack_cp->init.initiate_tag), vrf_id); + ntohl(initack_cp->init.initiate_tag), vrf_id, + (struct thread *)NULL + ); if (stcb == NULL) { struct mbuf *op_err; @@ -4601,6 +4610,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, vrf_id); SCTP_TCB_UNLOCK(stcb); goto out_now; + /* sa_ignore NOTREACHED */ break; case SCTP_STATE_EMPTY: /* should not happen */ case SCTP_STATE_INUSE: /* should not happen */ @@ -4609,6 +4619,7 @@ sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, default: SCTP_TCB_UNLOCK(stcb); goto out_now; + /* sa_ignore NOTREACHED */ break; case SCTP_STATE_OPEN: case SCTP_STATE_SHUTDOWN_SENT: -- cgit v1.3