sctp: another cleanup

No functional change intended.

(cherry picked from commit d08713dcdb)
This commit is contained in:
Michael Tuexen 2024-10-27 15:01:45 +01:00
parent c274b69f43
commit eac97072d1

View File

@ -543,7 +543,7 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint32_t ifn_index,
} else {
/*
* The last IFN gets the address, remove the
* old one
* old one.
*/
SCTPDBG(SCTP_DEBUG_PCB4,
"Moving ifa %p from %s (0x%x) to %s (0x%x)\n",
@ -691,13 +691,14 @@ 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
@ -705,10 +706,10 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
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
@ -717,13 +718,13 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
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) {
@ -757,9 +758,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);