diff options
Diffstat (limited to 'sys/netinet/sctp_pcb.c')
-rw-r--r-- | sys/netinet/sctp_pcb.c | 83 |
1 files changed, 44 insertions, 39 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 75af8b30e19d..c43342bfdb93 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -163,6 +163,7 @@ sctp_allocate_vrf(int vrf_id) #ifdef INVARIANTS panic("No memory for VRF:%d", vrf_id); #endif + SCTP_FREE(vrf); return (NULL); } vrf->vrf_ifn_hash = SCTP_HASH_INIT(SCTP_VRF_IFN_HASH_SIZE, @@ -172,6 +173,8 @@ sctp_allocate_vrf(int vrf_id) #ifdef INVARIANTS panic("No memory for VRF:%d", vrf_id); #endif + SCTP_HASH_FREE(vrf->vrf_addr_hash, vrf->vrf_addr_hashmark); + SCTP_FREE(vrf); return (NULL); } /* Add it to the hash table */ @@ -493,11 +496,11 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr, if (sctp_ifap) { sctp_ifap->localifa_flags &= SCTP_ADDR_VALID; sctp_ifap->localifa_flags |= SCTP_BEING_DELETED; - sctp_ifap->ifn_p->ifa_count--; vrf->total_ifa_count--; LIST_REMOVE(sctp_ifap, next_bucket); LIST_REMOVE(sctp_ifap, next_ifa); if (sctp_ifap->ifn_p) { + sctp_ifap->ifn_p->ifa_count--; if (SCTP_LIST_EMPTY(&sctp_ifap->ifn_p->ifalist)) { sctp_delete_ifn(sctp_ifap->ifn_p, 1); } @@ -1891,7 +1894,7 @@ sctp_inpcb_alloc(struct socket *so) m->size_of_a_cookie += SCTP_SIGNATURE_SIZE; /* Setup the initial secret */ - SCTP_GETTIME_TIMEVAL(&time); + (void)SCTP_GETTIME_TIMEVAL(&time); m->time_of_secret_change = time.tv_sec; for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) { @@ -2770,7 +2773,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) } if (cnt) { /* Ok we have someone out there that will kill us */ - SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); + (void)SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); SCTP_INP_WUNLOCK(inp); SCTP_ASOC_CREATE_UNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); @@ -2781,7 +2784,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) return; } if ((inp->refcount) || (inp->sctp_flags & SCTP_PCB_FLAGS_CLOSE_IP)) { - SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); + (void)SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); sctp_timer_start(SCTP_TIMER_TYPE_INPKILL, inp, NULL, NULL); SCTP_INP_WUNLOCK(inp); SCTP_ASOC_CREATE_UNLOCK(inp); @@ -2792,7 +2795,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) #endif return; } - SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); + (void)SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); inp->sctp_ep.signature_change.type = 0; inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_ALLGONE; @@ -2800,7 +2803,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) sctp_log_closing(inp, NULL, 5); #endif - SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); + (void)SCTP_OS_TIMER_STOP(&inp->sctp_ep.signature_change.timer); inp->sctp_ep.signature_change.type = SCTP_TIMER_TYPE_NONE; /* Clear the read queue */ while ((sq = TAILQ_FIRST(&inp->read_queue)) != NULL) { @@ -3082,7 +3085,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, } SCTP_INCR_RADDR_COUNT(); bzero(net, sizeof(*net)); - SCTP_GETTIME_TIMEVAL(&net->start_time); + (void)SCTP_GETTIME_TIMEVAL(&net->start_time); memcpy(&net->ro._l_addr, newaddr, newaddr->sa_len); if (newaddr->sa_family == AF_INET) { ((struct sockaddr_in *)&net->ro._l_addr)->sin_port = stcb->rport; @@ -3339,12 +3342,12 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, #ifdef SCTP_DEBUG if (sctp_debug_on & SCTP_DEBUG_PCB3) { printf("Allocate an association for peer:"); - if (firstaddr) + if (firstaddr) { sctp_print_address(firstaddr); - else + printf("Port:%d\n", + ntohs(((struct sockaddr_in *)firstaddr)->sin_port)); + } else printf("None\n"); - printf("Port:%d\n", - ntohs(((struct sockaddr_in *)firstaddr)->sin_port)); } #endif /* SCTP_DEBUG */ if (firstaddr->sa_family == AF_INET) { @@ -3557,7 +3560,7 @@ sctp_add_vtag_to_timewait(struct sctp_inpcb *inp, uint32_t tag, uint32_t time) struct timeval now; int set, i; - SCTP_GETTIME_TIMEVAL(&now); + (void)SCTP_GETTIME_TIMEVAL(&now); chain = &sctppcbinfo.vtag_timewait[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; set = 0; if (!SCTP_LIST_EMPTY(chain)) { @@ -3712,11 +3715,11 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre } } /* now clean up any other timers */ - SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer); asoc->hb_timer.self = NULL; - SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); asoc->dack_timer.self = NULL; - SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); /*- * For stream reset we don't blast this unless * it is a str-reset timer, it might be the @@ -3725,20 +3728,20 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre */ if (asoc->strreset_timer.type == SCTP_TIMER_TYPE_STRRESET) asoc->strreset_timer.self = NULL; - SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); asoc->asconf_timer.self = NULL; - SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); asoc->autoclose_timer.self = NULL; - SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); asoc->shut_guard_timer.self = NULL; - SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); asoc->delayed_event_timer.self = NULL; TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - SCTP_OS_TIMER_STOP(&net->fr_timer.timer); + (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer); net->fr_timer.self = NULL; - SCTP_OS_TIMER_STOP(&net->rxt_timer.timer); + (void)SCTP_OS_TIMER_STOP(&net->rxt_timer.timer); net->rxt_timer.self = NULL; - SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); + (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); net->pmtu_timer.self = NULL; } /* Now the read queue needs to be cleaned up (only once) */ @@ -3899,19 +3902,19 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre /* * Now restop the timers to be sure - this is paranoia at is finest! */ - SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); - SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer); - SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); - SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); - SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); - SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); - SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); - SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer); + (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer); TAILQ_FOREACH(net, &asoc->nets, sctp_next) { - SCTP_OS_TIMER_STOP(&net->fr_timer.timer); - SCTP_OS_TIMER_STOP(&net->rxt_timer.timer); - SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); + (void)SCTP_OS_TIMER_STOP(&net->fr_timer.timer); + (void)SCTP_OS_TIMER_STOP(&net->rxt_timer.timer); + (void)SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer); } asoc->strreset_timer.type = SCTP_TIMER_TYPE_NONE; @@ -4584,7 +4587,7 @@ sctp_pcb_init() sctp_pcb_initialized = 1; bzero(&sctpstat, sizeof(struct sctpstat)); - SCTP_GETTIME_TIMEVAL(&sctpstat.sctps_discontinuitytime); + (void)SCTP_GETTIME_TIMEVAL(&sctpstat.sctps_discontinuitytime); /* init the empty list of (All) Endpoints */ LIST_INIT(&sctppcbinfo.listhead); @@ -4987,8 +4990,10 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, phdr = sctp_get_next_param(m, offset, (struct sctp_paramhdr *)&ai, sizeof(ai)); aip = (struct sctp_adaptation_layer_indication *)phdr; - sctp_ulp_notify(SCTP_NOTIFY_ADAPTATION_INDICATION, - stcb, ntohl(aip->indication), NULL); + if (aip) { + sctp_ulp_notify(SCTP_NOTIFY_ADAPTATION_INDICATION, + stcb, ntohl(aip->indication), NULL); + } } } else if (ptype == SCTP_SET_PRIM_ADDR) { struct sctp_asconf_addr_param lstore, *fee; @@ -5133,7 +5138,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, stcb->asoc.peer_hmacs = sctp_alloc_hmaclist(num_hmacs); if (stcb->asoc.peer_hmacs != NULL) { for (i = 0; i < num_hmacs; i++) { - sctp_auth_add_hmacid(stcb->asoc.peer_hmacs, + (void)sctp_auth_add_hmacid(stcb->asoc.peer_hmacs, ntohs(hmacs->hmac_ids[i])); } } @@ -5159,7 +5164,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, else stcb->asoc.peer_auth_chunks = sctp_alloc_chunklist(); for (i = 0; i < num_chunks; i++) { - sctp_auth_add_chunk(chunks->chunk_types[i], + (void)sctp_auth_add_chunk(chunks->chunk_types[i], stcb->asoc.peer_auth_chunks); } got_chklist = 1; @@ -5552,7 +5557,7 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, struct sctp_tcb *stcb) asoc->highest_tsn_inside_map = asoc->cumulative_tsn; } asoc->last_revoke_count = cnt; - SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); + (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer); sctp_send_sack(stcb); sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_DRAIN); reneged_asoc_ids[reneged_at] = sctp_get_associd(stcb); |