- The address lock is changed to a rwlock. This

also involves macro changes to have a RLOCK and a WLOCK
  and placing the correct version within the code.
- The INP-INFO lock is changed to a rwlock.
- When sctp_shutdown() is called on Mac OS X, the socket lock is held.
  So call sctp_chunk_output with SCTP_SO_LOCKED and
  not SCTP_SO_NOT_LOCKED.
- Add SCTP_IPI_ADDR_[RW]LOCK and SCTP_IPI_ADDR_[RW]UNLOCK for Mac OS X.
- u_int64_t -> uint64_t
- add missing addr unlock for error return path
Approved by:	re@freebsd.org (K Smith)
This commit is contained in:
Randall Stewart 2007-09-18 15:16:39 +00:00
parent 915fabcd91
commit c99efcf633
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172218
9 changed files with 87 additions and 69 deletions

View File

@ -1529,6 +1529,7 @@ sctp_asconf_queue_sa_delete(struct sctp_tcb *stcb, struct sockaddr *sa)
/* delete goes to the back of the queue */
TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
/* sa_ignore MEMLEAK {memory is put on the tailq} */
return (0);
}
@ -2270,11 +2271,7 @@ sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa)
struct sctp_ifa *ifa;
/* find the ifa for the desired set primary */
if (stcb) {
vrf_id = stcb->asoc.vrf_id;
} else {
vrf_id = SCTP_DEFAULT_VRFID;
}
vrf_id = stcb->asoc.vrf_id;
ifa = sctp_find_ifa_by_addr(sa, vrf_id, SCTP_ADDR_NOT_LOCKED);
if (ifa == NULL) {
/* Invalid address */
@ -2347,11 +2344,11 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked)
struct sctp_ifa *sctp_ifa;
if (addr_locked == SCTP_ADDR_NOT_LOCKED)
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
vrf = sctp_find_vrf(stcb->asoc.vrf_id);
if (vrf == NULL) {
if (addr_locked == SCTP_ADDR_NOT_LOCKED)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (NULL);
}
LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) {
@ -2378,7 +2375,7 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked)
continue;
/* found a valid local v4 address to use */
if (addr_locked == SCTP_ADDR_NOT_LOCKED)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (&sctp_ifa->address.sa);
} else if (sctp_ifa->address.sa.sa_family == AF_INET6 &&
stcb->asoc.ipv6_addr_legal) {
@ -2401,14 +2398,14 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb, int addr_locked)
/* found a valid local v6 address to use */
if (addr_locked == SCTP_ADDR_NOT_LOCKED)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (&sctp_ifa->address.sa);
}
}
}
/* no valid addresses found */
if (addr_locked == SCTP_ADDR_NOT_LOCKED)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (NULL);
}
@ -2907,10 +2904,10 @@ sctp_check_address_list_all(struct sctp_tcb *stcb, struct mbuf *m, int offset,
} else {
return;
}
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return;
}
/* go through all our known interfaces */
@ -2935,7 +2932,7 @@ sctp_check_address_list_all(struct sctp_tcb *stcb, struct mbuf *m, int offset,
}
} /* end foreach ifa */
} /* end foreach ifn */
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
}
/*

View File

@ -82,34 +82,55 @@ extern int sctp_logoff_stuff;
#define SCTP_STATLOG_UNLOCK()
#define SCTP_STATLOG_DESTROY()
#define SCTP_INP_INFO_LOCK_DESTROY() do { \
if(rw_wowned(sctppcbinfo.ipi_ep_mtx)) { \
rw_wunlock(&sctppcbinfo.ipi_ep_mtx); \
} \
rw_destroy(sctppcbinfo.ipi_ep_mtx); \
} while (0)
#define SCTP_INP_INFO_LOCK_INIT() \
mtx_init(&sctppcbinfo.ipi_ep_mtx, "sctp-info", "inp_info", MTX_DEF)
rw_init(&sctppcbinfo.ipi_ep_mtx, "sctp-info");
#define SCTP_INP_INFO_RLOCK() do { \
mtx_lock(&sctppcbinfo.ipi_ep_mtx); \
rw_rlock(&sctppcbinfo.ipi_ep_mtx); \
} while (0)
#define SCTP_INP_INFO_WLOCK() do { \
mtx_lock(&sctppcbinfo.ipi_ep_mtx); \
rw_wlock(&sctppcbinfo.ipi_ep_mtx); \
} while (0)
#define SCTP_INP_INFO_RUNLOCK() rw_runlock(&sctppcbinfo.ipi_ep_mtx)
#define SCTP_INP_INFO_WUNLOCK() rw_wunlock(&sctppcbinfo.ipi_ep_mtx)
#define SCTP_IPI_ADDR_INIT() \
mtx_init(&sctppcbinfo.ipi_addr_mtx, "sctp-addr", "sctp_addr", MTX_DEF)
rw_init(&sctppcbinfo.ipi_addr_mtx, "sctp-addr")
#define SCTP_IPI_ADDR_DESTROY() \
mtx_destroy(&sctppcbinfo.ipi_addr_mtx)
#define SCTP_IPI_ADDR_DESTROY() do { \
if(rw_wowned(sctppcbinfo.ipi_addr_mtx)) { \
rw_wunlock(&sctppcbinfo.ipi_addr_mtx); \
} \
rw_destroy(&sctppcbinfo.ipi_addr_mtx) \
} while (0)
#define SCTP_IPI_ADDR_LOCK() do { \
mtx_lock(&sctppcbinfo.ipi_addr_mtx); \
#define SCTP_IPI_ADDR_RLOCK() do { \
rw_rlock(&sctppcbinfo.ipi_addr_mtx); \
} while (0)
#define SCTP_IPI_ADDR_UNLOCK() mtx_unlock(&sctppcbinfo.ipi_addr_mtx)
#define SCTP_IPI_ADDR_WLOCK() do { \
rw_wlock(&sctppcbinfo.ipi_addr_mtx); \
} while (0)
#define SCTP_IPI_ADDR_RUNLOCK() rw_runlock(&sctppcbinfo.ipi_addr_mtx)
#define SCTP_IPI_ADDR_WUNLOCK() rw_wunlock(&sctppcbinfo.ipi_addr_mtx)
#define SCTP_IPI_ITERATOR_WQ_INIT() \
mtx_init(&sctppcbinfo.ipi_iterator_wq_mtx, "sctp-it-wq", "sctp_it_wq", MTX_DEF)
@ -140,8 +161,6 @@ extern int sctp_logoff_stuff;
#define SCTP_INP_INFO_RUNLOCK() mtx_unlock(&sctppcbinfo.ipi_ep_mtx)
#define SCTP_INP_INFO_WUNLOCK() mtx_unlock(&sctppcbinfo.ipi_ep_mtx)
/*
* The INP locks we will use for locking an SCTP endpoint, so for example if

View File

@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/resourcevar.h>
#include <sys/uio.h>
#include <sys/lock.h>
#include <sys/rwlock.h>
#include <sys/kthread.h>
#include <sys/priv.h>
#include <sys/random.h>

View File

@ -1993,10 +1993,10 @@ sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, struct sctp_scoping *scope,
uint32_t vrf_id;
vrf_id = inp->def_vrf_id;
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (m_at);
}
if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
@ -2146,7 +2146,7 @@ sctp_add_addresses_to_i_ia(struct sctp_inpcb *inp, struct sctp_scoping *scope,
}
}
}
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (m_at);
}
@ -3056,7 +3056,7 @@ sctp_source_address_selection(struct sctp_inpcb *inp,
}
SCTPDBG(SCTP_DEBUG_OUTPUT2, "Select source addr for:");
SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, (struct sockaddr *)to);
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
/*
* Bound all case
@ -3064,7 +3064,7 @@ sctp_source_address_selection(struct sctp_inpcb *inp,
answer = sctp_choose_boundall(inp, stcb, net, ro, vrf_id,
dest_is_priv, dest_is_loop,
non_asoc_addr_ok, fam);
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (answer);
}
/*
@ -3081,7 +3081,7 @@ sctp_source_address_selection(struct sctp_inpcb *inp,
dest_is_priv,
dest_is_loop, fam);
}
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (answer);
}

View File

@ -285,13 +285,13 @@ sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_addr_lock)
return;
}
if (hold_addr_lock == 0)
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_WLOCK();
LIST_REMOVE(sctp_ifnp, next_bucket);
LIST_REMOVE(sctp_ifnp, next_ifn);
SCTP_DEREGISTER_INTERFACE(sctp_ifnp->ifn_index,
sctp_ifnp->registered_af);
if (hold_addr_lock == 0)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_WUNLOCK();
/* Take away the reference, and possibly free it */
sctp_free_ifn(sctp_ifnp);
}
@ -302,7 +302,7 @@ sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_n
struct sctp_vrf *vrf;
struct sctp_ifa *sctp_ifap = NULL;
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
SCTPDBG(SCTP_DEBUG_PCB1, "Can't find vrf_id:%d\n", vrf_id);
@ -345,7 +345,7 @@ sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_n
sctp_ifap->localifa_flags &= (~SCTP_ADDR_VALID);
sctp_ifap->localifa_flags |= SCTP_ADDR_IFA_UNUSEABLE;
out:
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
}
void
@ -354,7 +354,7 @@ sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_nam
struct sctp_vrf *vrf;
struct sctp_ifa *sctp_ifap = NULL;
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
SCTPDBG(SCTP_DEBUG_PCB1, "Can't find vrf_id:%d\n", vrf_id);
@ -397,7 +397,7 @@ sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_nam
sctp_ifap->localifa_flags &= (~SCTP_ADDR_IFA_UNUSEABLE);
sctp_ifap->localifa_flags |= SCTP_ADDR_VALID;
out:
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
}
@ -416,7 +416,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
int new_ifn_af = 0;
/* How granular do we need the locks to be here? */
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_WLOCK();
sctp_ifnp = sctp_find_ifn(ifn, ifn_index);
if (sctp_ifnp) {
vrf = sctp_ifnp->vrf;
@ -425,7 +425,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
if (vrf == NULL) {
vrf = sctp_allocate_vrf(vrf_id);
if (vrf == NULL) {
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_WUNLOCK();
return (NULL);
}
}
@ -435,7 +435,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
* build one and add it, can't hold lock until after malloc
* done though.
*/
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_WUNLOCK();
SCTP_MALLOC(sctp_ifnp, struct sctp_ifn *, sizeof(struct sctp_ifn), SCTP_M_IFN);
if (sctp_ifnp == NULL) {
#ifdef INVARIANTS
@ -459,7 +459,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
}
hash_ifn_head = &sctppcbinfo.vrf_ifn_hash[(ifn_index & sctppcbinfo.vrf_ifn_hashmark)];
LIST_INIT(&sctp_ifnp->ifalist);
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_WLOCK();
LIST_INSERT_HEAD(hash_ifn_head, sctp_ifnp, next_bucket);
LIST_INSERT_HEAD(&vrf->ifnlist, sctp_ifnp, next_ifn);
atomic_add_int(&sctppcbinfo.ipi_count_ifns, 1);
@ -480,7 +480,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
sctp_ifap->ifn_p = sctp_ifnp;
atomic_add_int(&sctp_ifap->ifn_p->refcount, 1);
exit_stage_left:
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_WUNLOCK();
return (sctp_ifap);
} else {
goto exit_stage_left;
@ -512,7 +512,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
goto exit_stage_left;
}
}
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_WUNLOCK();
SCTP_MALLOC(sctp_ifap, struct sctp_ifa *, sizeof(struct sctp_ifa), SCTP_M_IFA);
if (sctp_ifap == NULL) {
#ifdef INVARIANTS
@ -567,7 +567,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
(sctp_ifap->src_is_loop == 0)) {
sctp_ifap->src_is_glob = 1;
}
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_WLOCK();
hash_addr_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_addr_hashmark)];
LIST_INSERT_HEAD(hash_addr_head, sctp_ifap, next_bucket);
sctp_ifap->refcount = 1;
@ -579,7 +579,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
SCTP_REGISTER_INTERFACE(ifn_index, new_ifn_af);
sctp_ifnp->registered_af = new_ifn_af;
}
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_WUNLOCK();
if (dynamic_add) {
/*
* Bump up the refcount so that when the timer completes it
@ -629,8 +629,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
struct sctp_vrf *vrf;
struct sctp_ifa *sctp_ifap = NULL;
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_WLOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
SCTP_PRINTF("Can't find vrf_id:%d\n", vrf_id);
@ -678,6 +677,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
SCTPDBG(SCTP_DEBUG_PCB1, "ifn:%d ifname:%s - ignoring delete\n",
sctp_ifap->ifn_p->ifn_index, sctp_ifap->ifn_p->ifn_name);
#endif
SCTP_IPI_ADDR_WUNLOCK();
return;
}
}
@ -724,7 +724,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
#endif
out_now:
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_WUNLOCK();
if (sctp_ifap) {
struct sctp_laddr *wi;
@ -734,9 +734,9 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
* Gak, what can we do? We have lost an address
* change can you say HOSED?
*/
SCTPDBG(SCTP_DEBUG_PCB1, "Lost and address change ???\n");
SCTPDBG(SCTP_DEBUG_PCB1, "Lost an address change?\n");
/* Opps, must decrement the count */
/* Oops, must decrement the count */
sctp_free_ifa(sctp_ifap);
return;
}

View File

@ -186,10 +186,10 @@ struct sctp_epinfo {
sctp_zone_t ipi_zone_strmoq;
sctp_zone_t ipi_zone_asconf_ack;
struct mtx ipi_ep_mtx;
struct rwlock ipi_ep_mtx;
struct mtx it_mtx;
struct mtx ipi_iterator_wq_mtx;
struct mtx ipi_addr_mtx;
struct rwlock ipi_addr_mtx;
struct mtx ipi_pktlog_mtx;
uint32_t ipi_count_ep;

View File

@ -1021,7 +1021,7 @@ struct xsctp_raddr {
#define SCTP_TRACE_PARAMS 6 /* This number MUST be even */
struct sctp_log_entry {
u_int64_t timestamp;
uint64_t timestamp;
uint32_t subsys;
uint32_t padding;
uint32_t params[SCTP_TRACE_PARAMS];

View File

@ -964,7 +964,7 @@ sctp_shutdown(struct socket *so)
sctp_stop_timers_for_shutdown(stcb);
sctp_send_shutdown(stcb,
stcb->asoc.primary_destination);
sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_NOT_LOCKED);
sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED);
if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) ||
(SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
SCTP_STAT_DECR_GAUGE32(sctps_currestab);
@ -1224,11 +1224,11 @@ sctp_fill_up_addresses(struct sctp_inpcb *inp,
{
size_t size = 0;
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
/* fill up addresses for the endpoint's default vrf */
size = sctp_fill_up_addresses_vrf(inp, stcb, limit, sas,
inp->def_vrf_id);
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (size);
}
@ -1291,10 +1291,10 @@ sctp_count_max_addresses(struct sctp_inpcb *inp)
{
int cnt = 0;
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
/* count addresses for the endpoint's default VRF */
cnt = sctp_count_max_addresses_vrf(inp, inp->def_vrf_id);
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (cnt);
}

View File

@ -336,7 +336,7 @@ sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from)
sctp_clog.x.lock.inp_lock = SCTP_LOCK_UNKNOWN;
sctp_clog.x.lock.create_lock = SCTP_LOCK_UNKNOWN;
}
sctp_clog.x.lock.info_lock = mtx_owned(&sctppcbinfo.ipi_ep_mtx);
sctp_clog.x.lock.info_lock = rw_wowned(&sctppcbinfo.ipi_ep_mtx);
if (inp->sctp_socket) {
sctp_clog.x.lock.sock_lock = mtx_owned(&(inp->sctp_socket->so_rcv.sb_mtx));
sctp_clog.x.lock.sockrcvbuf_lock = mtx_owned(&(inp->sctp_socket->so_rcv.sb_mtx));
@ -4758,12 +4758,12 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
uint32_t hash_of_addr;
if (holds_lock == 0)
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
if (holds_lock == 0)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (NULL);
}
hash_of_addr = sctp_get_ifa_hash_val(addr);
@ -4771,12 +4771,12 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
hash_head = &vrf->vrf_addr_hash[(hash_of_addr & vrf->vrf_addr_hashmark)];
if (hash_head == NULL) {
SCTP_PRINTF("hash_of_addr:%x mask:%x table:%x - ",
(u_int)hash_of_addr, (u_int)vrf->vrf_addr_hashmark,
(u_int)(hash_of_addr & vrf->vrf_addr_hashmark));
hash_of_addr, (uint32_t) vrf->vrf_addr_hashmark,
(uint32_t) (hash_of_addr & vrf->vrf_addr_hashmark));
sctp_print_address(addr);
SCTP_PRINTF("No such bucket for address\n");
if (holds_lock == 0)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (NULL);
}
@ -4791,7 +4791,7 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
sctp_ifap->address.sin.sin_addr.s_addr) {
/* found him. */
if (holds_lock == 0)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (sctp_ifap);
break;
}
@ -4800,14 +4800,14 @@ sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock)
&sctp_ifap->address.sin6.sin6_addr)) {
/* found him. */
if (holds_lock == 0)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (sctp_ifap);
break;
}
}
}
if (holds_lock == 0)
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (NULL);
}
@ -6373,11 +6373,11 @@ sctp_local_addr_count(struct sctp_tcb *stcb)
ipv4_addr_legal = 1;
}
SCTP_IPI_ADDR_LOCK();
SCTP_IPI_ADDR_RLOCK();
vrf = sctp_find_vrf(stcb->asoc.vrf_id);
if (vrf == NULL) {
/* no vrf, no addresses */
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (0);
}
if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
@ -6453,7 +6453,7 @@ sctp_local_addr_count(struct sctp_tcb *stcb)
count++;
}
}
SCTP_IPI_ADDR_UNLOCK();
SCTP_IPI_ADDR_RUNLOCK();
return (count);
}