Skip to content

Commit

Permalink
more cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
tuexen committed Oct 27, 2024
1 parent e92f3b3 commit ead08b7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions usrsctplib/netinet/sctp_pcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,38 +777,39 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
uint32_t ifn_index, const char *if_name)
{
struct sctp_vrf *vrf;
struct sctp_ifa *sctp_ifap = NULL;
struct sctp_ifa *sctp_ifap;

SCTP_IPI_ADDR_WLOCK();
vrf = sctp_find_vrf(vrf_id);
if (vrf == NULL) {
SCTPDBG(SCTP_DEBUG_PCB4, "Can't find vrf_id 0x%x\n", vrf_id);
goto out_now;
SCTP_IPI_ADDR_WUNLOCK();
return;
}

#ifdef SCTP_DEBUG
SCTPDBG(SCTP_DEBUG_PCB4, "vrf_id 0x%x: deleting address:", vrf_id);
SCTPDBG_ADDR(SCTP_DEBUG_PCB4, addr);
#endif
sctp_ifap = sctp_find_ifa_by_addr(addr, vrf->vrf_id, SCTP_ADDR_LOCKED);
if (sctp_ifap) {
if (sctp_ifap != NULL) {
/* Validate the delete */
if (sctp_ifap->ifn_p) {
int valid = 0;
bool valid = false;
/*-
* The name has priority over the ifn_index
* if its given.
*/
if (if_name) {
if (strncmp(if_name, sctp_ifap->ifn_p->ifn_name, SCTP_IFNAMSIZ) == 0) {
/* They match its a correct delete */
valid = 1;
valid = true;
}
}
if (!valid) {
/* last ditch check ifn_index */
if (ifn_index == sctp_ifap->ifn_p->ifn_index) {
valid = 1;
valid = true;
}
}
if (!valid) {
Expand Down Expand Up @@ -841,9 +842,8 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
}
#endif

out_now:
SCTP_IPI_ADDR_WUNLOCK();
if (sctp_ifap) {
if (sctp_ifap != NULL) {
struct sctp_laddr *wi;

wi = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_laddr), struct sctp_laddr);
Expand Down

0 comments on commit ead08b7

Please sign in to comment.