diff options
Diffstat (limited to 'net/sctp/bind_addr.c')
-rw-r--r-- | net/sctp/bind_addr.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index 432661174789..13fbfb449a55 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c | |||
@@ -353,6 +353,32 @@ int sctp_bind_addr_match(struct sctp_bind_addr *bp, | |||
353 | return match; | 353 | return match; |
354 | } | 354 | } |
355 | 355 | ||
356 | /* Get the state of the entry in the bind_addr_list */ | ||
357 | int sctp_bind_addr_state(const struct sctp_bind_addr *bp, | ||
358 | const union sctp_addr *addr) | ||
359 | { | ||
360 | struct sctp_sockaddr_entry *laddr; | ||
361 | struct sctp_af *af; | ||
362 | int state = -1; | ||
363 | |||
364 | af = sctp_get_af_specific(addr->sa.sa_family); | ||
365 | if (unlikely(!af)) | ||
366 | return state; | ||
367 | |||
368 | rcu_read_lock(); | ||
369 | list_for_each_entry_rcu(laddr, &bp->address_list, list) { | ||
370 | if (!laddr->valid) | ||
371 | continue; | ||
372 | if (af->cmp_addr(&laddr->a, addr)) { | ||
373 | state = laddr->state; | ||
374 | break; | ||
375 | } | ||
376 | } | ||
377 | rcu_read_unlock(); | ||
378 | |||
379 | return state; | ||
380 | } | ||
381 | |||
356 | /* Find the first address in the bind address list that is not present in | 382 | /* Find the first address in the bind address list that is not present in |
357 | * the addrs packed array. | 383 | * the addrs packed array. |
358 | */ | 384 | */ |