diff options
Diffstat (limited to 'sys/netinet/sctp_pcb.c')
-rw-r--r-- | sys/netinet/sctp_pcb.c | 259 |
1 files changed, 96 insertions, 163 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 58413ec..09bdd2e 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -445,11 +445,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index, * Gak, what can we do? We have lost an address * change can you say HOSED? */ -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Lost and address change ???\n"); - } -#endif /* SCTP_DEBUG */ + SCTPDBG(SCTP_DEBUG_PCB1, "Lost and address change ???\n"); /* Opps, must decrement the count */ sctp_del_addr_from_vrf(vrf_id, addr, ifn_index); return (NULL); @@ -487,9 +483,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr, vrf = sctp_find_vrf(vrf_id); if (vrf == NULL) { -#ifdef SCTP_DEBUG - printf("Can't find vrf_id:%d\n", vrf_id); -#endif + SCTP_PRINTF("Can't find vrf_id:%d\n", vrf_id); goto out_now; } sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, 1); @@ -510,11 +504,12 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr, } #ifdef SCTP_DEBUG else { - printf("Del Addr-ifn:%d Could not find address:", + SCTPDBG(SCTP_DEBUG_PCB1, "Del Addr-ifn:%d Could not find address:", ifn_index); - sctp_print_address(addr); + SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr); } #endif + out_now: SCTP_IPI_ADDR_UNLOCK(); if (sctp_ifap) { @@ -526,11 +521,7 @@ out_now: * Gak, what can we do? We have lost an address * change can you say HOSED? */ -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Lost and address change ???\n"); - } -#endif /* SCTP_DEBUG */ + SCTPDBG(SCTP_DEBUG_PCB1, "Lost and address change ???\n"); /* Opps, must decrement the count */ sctp_free_ifa(sctp_ifap); @@ -615,19 +606,11 @@ sctp_tcb_special_locate(struct sctp_inpcb **inp_p, struct sockaddr *from, LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { if (laddr->ifa == NULL) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("An ounce of prevention is worth a pound of cure\n"); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "%s: NULL ifa\n", __FUNCTION__); continue; } if (laddr->ifa->localifa_flags & SCTP_BEING_DELETED) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("ifa being deleted\n"); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "ifa being deleted\n"); continue; } if (laddr->ifa->address.sa.sa_family == @@ -1138,25 +1121,14 @@ sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, } LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { if (laddr->ifa == NULL) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("An ounce of prevention is worth a pound of cure\n"); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "%s: NULL ifa\n", + __FUNCTION__); continue; } -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Ok laddr->ifa:%p is possible, ", - laddr->ifa); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "Ok laddr->ifa:%p is possible, ", + laddr->ifa); if (laddr->ifa->localifa_flags & SCTP_BEING_DELETED) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Huh IFA being deleted\n"); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "Huh IFA being deleted\n"); continue; } if (laddr->ifa->address.sa.sa_family == nam->sa_family) { @@ -1189,7 +1161,8 @@ sctp_endpoint_probe(struct sockaddr *nam, struct sctppcbhead *head, struct sctp_inpcb * -sctp_pcb_findep(struct sockaddr *nam, int find_tcp_pool, int have_lock, uint32_t vrf_id) +sctp_pcb_findep(struct sockaddr *nam, int find_tcp_pool, int have_lock, + uint32_t vrf_id) { /* * First we check the hash table to see if someone has this port @@ -1442,7 +1415,8 @@ sctp_findassoc_by_vtag(struct sockaddr *from, uint32_t vtag, } if (skip_src_check) { *netp = NULL; /* unknown */ - *inp_p = stcb->sctp_ep; + if (inp_p) + *inp_p = stcb->sctp_ep; SCTP_INP_INFO_RUNLOCK(); return (stcb); } @@ -1567,11 +1541,7 @@ sctp_findassociation_addr(struct mbuf *m, int iphlen, int offset, retval = sctp_findassociation_addr_sa(to, from, &inp, netp, find_tcp_pool, vrf_id); } -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("retval:%p inp:%p\n", retval, inp); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "retval:%p inp:%p\n", retval, inp); if (retval == NULL && inp) { /* Found a EP but not this address */ if ((ch->chunk_type == SCTP_INITIATION) || @@ -1597,11 +1567,7 @@ sctp_findassociation_addr(struct mbuf *m, int iphlen, int offset, } } } -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("retval is %p\n", retval); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "retval is %p\n", retval); return (retval); } @@ -1652,11 +1618,8 @@ sctp_findassociation_ep_asconf(struct mbuf *m, int iphlen, int offset, phdr = sctp_get_next_param(m, offset + sizeof(struct sctp_asconf_chunk), &parm_buf, sizeof(struct sctp_paramhdr)); if (phdr == NULL) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_INPUT3) { - printf("findassociation_ep_asconf: failed to get asconf lookup addr\n"); - } -#endif /* SCTP_DEBUG */ + SCTPDBG(SCTP_DEBUG_INPUT3, "%s: failed to get asconf lookup addr\n", + __FUNCTION__); return NULL; } ptype = (int)((uint32_t) ntohs(phdr->param_type)); @@ -1672,11 +1635,8 @@ sctp_findassociation_ep_asconf(struct mbuf *m, int iphlen, int offset, offset + sizeof(struct sctp_asconf_chunk), &p6_buf.ph, sizeof(*p6)); if (p6 == NULL) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_INPUT3) { - printf("findassociation_ep_asconf: failed to get asconf v6 lookup addr\n"); - } -#endif /* SCTP_DEBUG */ + SCTPDBG(SCTP_DEBUG_INPUT3, "%s: failed to get asconf v6 lookup addr\n", + __FUNCTION__); return (NULL); } sin6 = (struct sockaddr_in6 *)&remote_store; @@ -1697,11 +1657,8 @@ sctp_findassociation_ep_asconf(struct mbuf *m, int iphlen, int offset, offset + sizeof(struct sctp_asconf_chunk), &p4_buf.ph, sizeof(*p4)); if (p4 == NULL) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_INPUT3) { - printf("findassociation_ep_asconf: failed to get asconf v4 lookup addr\n"); - } -#endif /* SCTP_DEBUG */ + SCTPDBG(SCTP_DEBUG_INPUT3, "%s: failed to get asconf v4 lookup addr\n", + __FUNCTION__); return (NULL); } sin = (struct sockaddr_in *)&remote_store; @@ -1759,7 +1716,7 @@ sctp_inpcb_alloc(struct socket *so) SCTP_INP_INFO_WLOCK(); inp = SCTP_ZONE_GET(sctppcbinfo.ipi_zone_ep, struct sctp_inpcb); if (inp == NULL) { - printf("Out of SCTP-INPCB structures - no resources\n"); + SCTP_PRINTF("Out of SCTP-INPCB structures - no resources\n"); SCTP_INP_INFO_WUNLOCK(); return (ENOBUFS); } @@ -1819,7 +1776,7 @@ sctp_inpcb_alloc(struct socket *so) inp->sctp_tcbhash = SCTP_HASH_INIT(sctp_pcbtblsize, &inp->sctp_hashmark); if (inp->sctp_tcbhash == NULL) { - printf("Out of SCTP-INPCB->hashinit - no resources\n"); + SCTP_PRINTF("Out of SCTP-INPCB->hashinit - no resources\n"); SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp); return (ENOBUFS); } @@ -1995,11 +1952,7 @@ sctp_move_pcb_and_assoc(struct sctp_inpcb *old_inp, struct sctp_inpcb *new_inp, * HOSED. We probably should send an abort * here. */ -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Association hosed in TCP model, out of laddr memory\n"); - } -#endif /* SCTP_DEBUG */ + SCTPDBG(SCTP_DEBUG_PCB1, "Association hosed in TCP model, out of laddr memory\n"); continue; } SCTP_INCR_LADDR_COUNT(); @@ -2103,15 +2056,13 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, struct thread *p) inp = (struct sctp_inpcb *)so->so_pcb; ip_inp = (struct inpcb *)so->so_pcb; #ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - if (addr) { - printf("Bind called port:%d\n", - ntohs(((struct sockaddr_in *)addr)->sin_port)); - printf("Addr :"); - sctp_print_address(addr); - } + if (addr) { + SCTPDBG(SCTP_DEBUG_PCB1, "Bind called port:%d\n", + ntohs(((struct sockaddr_in *)addr)->sin_port)); + SCTPDBG(SCTP_DEBUG_PCB1, "Addr :"); + SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr); } -#endif /* SCTP_DEBUG */ +#endif if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == 0) { /* already did a bind, subsequent binds NOT allowed ! */ return (EINVAL); @@ -2415,11 +2366,8 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, struct thread *p) sctppcbinfo.hashmark)]; /* put it in the bucket */ LIST_INSERT_HEAD(head, inp, sctp_hash); -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Main hash to bind at head:%p, bound port:%d\n", head, ntohs(lport)); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "Main hash to bind at head:%p, bound port:%d\n", + head, ntohs(lport)); /* set in the port */ inp->sctp_lport = lport; @@ -2519,7 +2467,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) so = inp->sctp_socket; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { /* been here before.. eeks.. get out of here */ - printf("This conflict in free SHOULD not be happening!\n"); + SCTP_PRINTF("This conflict in free SHOULD not be happening!\n"); SCTP_ITERATOR_UNLOCK(); #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 1); @@ -2530,9 +2478,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) SCTP_INP_INFO_WLOCK(); SCTP_INP_WLOCK(inp); - /* - * First time through we have the socket lock, after that no more. - */ + /* First time through we have the socket lock, after that no more. */ if (from == SCTP_CALLED_AFTER_CMPSET_OFCLOSE) { /* * Once we are in we can remove the flag from = 1 is only @@ -2651,7 +2597,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) sp = TAILQ_LAST(&((asoc->asoc.locked_on_sending)->outqueue), sctp_streamhead); if (sp == NULL) { - printf("Error, sp is NULL, locked on sending is %p strm:%d\n", + SCTP_PRINTF("Error, sp is NULL, locked on sending is %p strm:%d\n", asoc->asoc.locked_on_sending, asoc->asoc.locked_on_sending->stream_no); } else { @@ -2930,11 +2876,6 @@ sctp_findnet(struct sctp_tcb *stcb, struct sockaddr *addr) } -/* - * add's a remote endpoint address, done with the INIT/INIT-ACK as well as - * when a ASCONF arrives that adds it. It will also initialize all the cwnd - * stats of stuff. - */ int sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id) { @@ -2959,6 +2900,13 @@ sctp_set_initial_cc_param(struct sctp_tcb *stcb, struct sctp_nets *net) net->ssthresh = stcb->asoc.peers_rwnd; } + + +/* + * add's a remote endpoint address, done with the INIT/INIT-ACK as well as + * when a ASCONF arrives that adds it. It will also initialize all the cwnd + * stats of stuff. + */ int sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, int set_scope, int from) @@ -2971,12 +2919,9 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, struct sctp_nets *net, *netfirst; int addr_inscope; -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Adding an address (from:%d) to the peer: ", from); - sctp_print_address(newaddr); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "Adding an address (from:%d) to the peer: ", + from); + SCTPDBG_ADDR(SCTP_DEBUG_PCB1, newaddr); netfirst = sctp_findnet(stcb, newaddr); if (netfirst) { @@ -3162,7 +3107,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, net->mtu = 0; } #ifdef SCTP_PRINT_FOR_B_AND_M - printf("We have found an interface mtu of %d\n", net->mtu); + SCTP_PRINTF("We have found an interface mtu of %d\n", net->mtu); #endif if (net->mtu == 0) { /* Huh ?? */ @@ -3172,7 +3117,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, rmtu = SCTP_GATHER_MTU_FROM_ROUTE(net->ro._s_addr, &net->ro._l_addr.sa, net->ro.ro_rt); #ifdef SCTP_PRINT_FOR_B_AND_M - printf("The route mtu is %d\n", rmtu); + SCTP_PRINTF("The route mtu is %d\n", rmtu); #endif if (rmtu == 0) { /* @@ -3192,8 +3137,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, } if (from == SCTP_ALLOC_ASOC) { #ifdef SCTP_PRINT_FOR_B_AND_M - printf("New assoc sets mtu to :%d\n", - net->mtu); + SCTP_PRINTF("New assoc sets mtu to :%d\n", net->mtu); #endif stcb->asoc.smallest_mtu = net->mtu; } @@ -3202,7 +3146,7 @@ sctp_add_remote_addr(struct sctp_tcb *stcb, struct sockaddr *newaddr, } if (stcb->asoc.smallest_mtu > net->mtu) { #ifdef SCTP_PRINT_FOR_B_AND_M - printf("new address mtu:%d smaller than smallest:%d\n", + SCTP_PRINTF("new address mtu:%d smaller than smallest:%d\n", net->mtu, stcb->asoc.smallest_mtu); #endif stcb->asoc.smallest_mtu = net->mtu; @@ -3327,6 +3271,10 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, *error = ENOBUFS; return (NULL); } + if (firstaddr == NULL) { + *error = EINVAL; + return (NULL); + } SCTP_INP_RLOCK(inp); if (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) { /* @@ -3339,15 +3287,14 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, *error = EINVAL; return (NULL); } + SCTPDBG(SCTP_DEBUG_PCB3, "Allocate an association for peer:"); #ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB3) { - printf("Allocate an association for peer:"); - if (firstaddr) { - sctp_print_address(firstaddr); - printf("Port:%d\n", - ntohs(((struct sockaddr_in *)firstaddr)->sin_port)); - } else - printf("None\n"); + if (firstaddr) { + SCTPDBG_ADDR(SCTP_DEBUG_PCB3, firstaddr); + SCTPDBG(SCTP_DEBUG_PCB3, "Port:%d\n", + ntohs(((struct sockaddr_in *)firstaddr)->sin_port)); + } else { + SCTPDBG(SCTP_DEBUG_PCB3, "None\n"); } #endif /* SCTP_DEBUG */ if (firstaddr->sa_family == AF_INET) { @@ -3474,11 +3421,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, LIST_INSERT_HEAD(head, stcb, sctp_tcbhash); } SCTP_INP_WUNLOCK(inp); -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("Association %p now allocated\n", stcb); - } -#endif + SCTPDBG(SCTP_DEBUG_PCB1, "Association %p now allocated\n", stcb); return (stcb); } @@ -4275,11 +4218,8 @@ sctp_update_ep_vflag(struct sctp_inpcb *inp) /* set the flag based on addresses on the ep list */ LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { if (laddr->ifa == NULL) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - printf("An ounce of prevention is worth a pound of cure\n"); - } -#endif /* SCTP_DEBUG */ + SCTPDBG(SCTP_DEBUG_PCB1, "%s: NULL ifa\n", + __FUNCTION__); continue; } if (laddr->ifa->localifa_flags & SCTP_BEING_DELETED) { @@ -4297,22 +4237,22 @@ sctp_update_ep_vflag(struct sctp_inpcb *inp) * Add the address to the endpoint local address list There is nothing to be * done if we are bound to all addresses */ -int +void sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t action) { struct sctp_laddr *laddr; - int fnd, error; + int fnd, error = 0; fnd = 0; if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { /* You are already bound to all. You have it already */ - return (0); + return; } if (ifa->address.sa.sa_family == AF_INET6) { if (ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) { /* Can't bind a non-useable addr. */ - return (-1); + return; } } /* first, is it already present? */ @@ -4327,7 +4267,7 @@ sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t ac /* Not in the ep list */ error = sctp_insert_laddr(&inp->sctp_addr_list, ifa, action); if (error != 0) - return (error); + return; inp->laddr_count++; /* update inp_vflag flags */ if (ifa->address.sa.sa_family == AF_INET6) { @@ -4336,7 +4276,7 @@ sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t ac inp->ip_inp.inp.inp_vflag |= INP_IPV4; } } - return (0); + return; } @@ -4368,7 +4308,7 @@ sctp_select_primary_destination(struct sctp_tcb *stcb) * Delete the address from the endpoint local address list There is nothing * to be done if we are bound to all addresses */ -int +void sctp_del_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) { struct sctp_laddr *laddr; @@ -4377,7 +4317,7 @@ sctp_del_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) fnd = 0; if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { /* You are already bound to all. You have it already */ - return (EINVAL); + return; } LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { if (laddr->ifa == ifa) { @@ -4387,7 +4327,7 @@ sctp_del_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) } if (fnd && (inp->laddr_count < 2)) { /* can't delete unless there are at LEAST 2 addresses */ - return (-1); + return; } if (fnd) { /* @@ -4440,7 +4380,7 @@ sctp_del_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) /* update inp_vflag flags */ sctp_update_ep_vflag(inp); } - return (0); + return; } /* @@ -4449,13 +4389,12 @@ sctp_del_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa) * ASCONF-ACK response) For the subset binding, static case, this is a * "valid" address list */ -int +void sctp_add_local_addr_assoc(struct sctp_tcb *stcb, struct sctp_ifa *ifa, int restricted_list) { struct sctp_inpcb *inp; struct sctp_laddr *laddr; struct sctpladdr *list; - int error; /* * Assumes TCB is locked.. and possibly the INP. May need to @@ -4467,21 +4406,19 @@ sctp_add_local_addr_assoc(struct sctp_tcb *stcb, struct sctp_ifa *ifa, int restr if (ifa->address.sa.sa_family == AF_INET6) { if (ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) { /* Can't bind a non-existent addr. */ - return (-1); + return; } } /* does the address already exist? */ LIST_FOREACH(laddr, list, sctp_nxt_addr) { if (laddr->ifa == ifa) { - return (-1); + return; } } /* add to the list */ - error = sctp_insert_laddr(list, ifa, 0); - if (error != 0) - return (error); - return (0); + (void)sctp_insert_laddr(list, ifa, 0); + return; } /* @@ -4525,7 +4462,7 @@ sctp_remove_laddr(struct sctp_laddr *laddr) /* * Remove an address from the TCB local address list */ -int +void sctp_del_local_addr_assoc(struct sctp_tcb *stcb, struct sctp_ifa *ifa) { struct sctp_inpcb *inp; @@ -4547,7 +4484,7 @@ sctp_del_local_addr_assoc(struct sctp_tcb *stcb, struct sctp_ifa *ifa) (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DO_ASCONF) == 0)) { if (stcb->asoc.numnets < 2) { /* can't delete last address */ - return (-1); + return; } } LIST_FOREACH(laddr, &stcb->asoc.sctp_restricted_addrs, sctp_nxt_addr) { @@ -4556,12 +4493,12 @@ sctp_del_local_addr_assoc(struct sctp_tcb *stcb, struct sctp_ifa *ifa) continue; if (laddr->ifa == ifa) { sctp_remove_laddr(laddr); - return (0); + return; } } /* address not found! */ - return (-1); + return; } static char sctp_pcb_initialized = 0; @@ -5017,7 +4954,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, if (lptype == SCTP_IPV4_ADDRESS) { if (plen != sizeof(struct sctp_asconf_addrv4_param)) { - printf("Sizeof setprim in init/init ack not %d but %d - ignored\n", + SCTP_PRINTF("Sizeof setprim in init/init ack not %d but %d - ignored\n", (int)sizeof(struct sctp_asconf_addrv4_param), plen); } else { @@ -5028,7 +4965,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, } else if (lptype == SCTP_IPV6_ADDRESS) { if (plen != sizeof(struct sctp_asconf_addr_param)) { - printf("Sizeof setprim (v6) in init/init ack not %d but %d - ignored\n", + SCTP_PRINTF("Sizeof setprim (v6) in init/init ack not %d but %d - ignored\n", (int)sizeof(struct sctp_asconf_addr_param), plen); } else { @@ -5039,7 +4976,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, } } if (lsa) { - sctp_set_primary_addr(stcb, sa, NULL); + (void)sctp_set_primary_addr(stcb, sa, NULL); } } else if (ptype == SCTP_PRSCTP_SUPPORTED) { /* Peer supports pr-sctp */ @@ -5106,10 +5043,7 @@ sctp_load_addresses_from_init(struct sctp_tcb *stcb, struct mbuf *m, random_len = plen - sizeof(*p_random); /* enforce the random length */ if (random_len != SCTP_AUTH_RANDOM_SIZE_REQUIRED) { -#ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_AUTH1) - printf("SCTP: invalid RANDOM len\n"); -#endif + SCTPDBG(SCTP_DEBUG_AUTH1, "SCTP: invalid RANDOM len\n"); return (-27); } got_random = 1; @@ -5514,12 +5448,10 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, struct sctp_tcb *stcb) * if we see a possible attack underway just abort the association. */ #ifdef SCTP_DEBUG - if (sctp_debug_on & SCTP_DEBUG_PCB1) { - if (cnt) { - printf("Freed %d chunks from reneg harvest\n", cnt); - } + if (cnt) { + SCTPDBG(SCTP_DEBUG_PCB1, "Freed %d chunks from reneg harvest\n", cnt); } -#endif /* SCTP_DEBUG */ +#endif if (cnt) { /* * Now do we need to find a new @@ -5538,7 +5470,7 @@ sctp_drain_mbufs(struct sctp_inpcb *inp, struct sctp_tcb *stcb) * have found NO data... wierd... we will start at * end of mapping array. */ - printf("Gap was larger than array?? %d set to max:%d maparraymax:%x\n", + SCTP_PRINTF("Gap was larger than array?? %d set to max:%d maparraymax:%x\n", (int)gap, (int)(asoc->mapping_array_size << 3), (int)asoc->highest_tsn_inside_map); @@ -5661,8 +5593,9 @@ sctp_initiate_iterator(inp_func inpf, } SCTP_IPI_ITERATOR_WQ_LOCK(); - if (it->inp) + if (it->inp) { SCTP_INP_INCR_REF(it->inp); + } TAILQ_INSERT_TAIL(&sctppcbinfo.iteratorhead, it, sctp_nxt_itr); #if defined(SCTP_USE_THREAD_BASED_ITERATOR) if (sctppcbinfo.iterator_running == 0) { |