Skip to content

Commit

Permalink
cleanup: no functional change
Browse files Browse the repository at this point in the history
  • Loading branch information
tuexen committed Oct 25, 2024
1 parent b9b3ded commit 1c22f31
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 32 deletions.
6 changes: 3 additions & 3 deletions usrsctplib/netinet/sctp_asconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1347,13 +1347,13 @@ sctp_asconf_queue_mgmt(struct sctp_tcb *stcb, struct sctp_ifa *ifa,
#ifdef SCTP_DEBUG
if (SCTP_BASE_SYSCTL(sctp_debug_on) & SCTP_DEBUG_ASCONF2) {
if (type == SCTP_ADD_IP_ADDRESS) {
SCTP_PRINTF("asconf_queue_mgmt: inserted asconf ADD_IP_ADDRESS: ");
SCTPDBG(SCTP_DEBUG_ASCONF2, "asconf_queue_mgmt: inserted asconf ADD_IP_ADDRESS: ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF2, &ifa->address.sa);
} else if (type == SCTP_DEL_IP_ADDRESS) {
SCTP_PRINTF("asconf_queue_mgmt: appended asconf DEL_IP_ADDRESS: ");
SCTPDBG(SCTP_DEBUG_ASCONF2, "asconf_queue_mgmt: appended asconf DEL_IP_ADDRESS: ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF2, &ifa->address.sa);
} else {
SCTP_PRINTF("asconf_queue_mgmt: appended asconf SET_PRIM_ADDR: ");
SCTPDBG(SCTP_DEBUG_ASCONF2, "asconf_queue_mgmt: appended asconf SET_PRIM_ADDR: ");
SCTPDBG_ADDR(SCTP_DEBUG_ASCONF2, &ifa->address.sa);
}
}
Expand Down
8 changes: 4 additions & 4 deletions usrsctplib/netinet/sctp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -15074,23 +15074,23 @@ sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro)
mask = (struct sockaddr_in *)(ifa->ifa_netmask);
sin = &sifa->address.sin;
srcnetaddr.s_addr = (sin->sin_addr.s_addr & mask->sin_addr.s_addr);
SCTPDBG(SCTP_DEBUG_OUTPUT1, "match_nexthop4: src address is ");
SCTPDBG(SCTP_DEBUG_OUTPUT2, "match_nexthop4: src address is ");
SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, &sifa->address.sa);
SCTPDBG(SCTP_DEBUG_OUTPUT1, "network address is %x\n", srcnetaddr.s_addr);
SCTPDBG(SCTP_DEBUG_OUTPUT2, "network address is %x\n", srcnetaddr.s_addr);

#if defined(__FreeBSD__)
sin = &ro->ro_nh->gw4_sa;
#else
sin = (struct sockaddr_in *)ro->ro_rt->rt_gateway;
#endif
gwnetaddr.s_addr = (sin->sin_addr.s_addr & mask->sin_addr.s_addr);
SCTPDBG(SCTP_DEBUG_OUTPUT1, "match_nexthop4: nexthop is ");
SCTPDBG(SCTP_DEBUG_OUTPUT2, "match_nexthop4: nexthop is ");
#if defined(__FreeBSD__)
SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, &ro->ro_nh->gw_sa);
#else
SCTPDBG_ADDR(SCTP_DEBUG_OUTPUT2, ro->ro_rt->rt_gateway);
#endif
SCTPDBG(SCTP_DEBUG_OUTPUT1, "network address is %x\n", gwnetaddr.s_addr);
SCTPDBG(SCTP_DEBUG_OUTPUT2, "network address is %x\n", gwnetaddr.s_addr);
if (srcnetaddr.s_addr == gwnetaddr.s_addr) {
return (1);
}
Expand Down
32 changes: 9 additions & 23 deletions usrsctplib/netinet/sctp_pcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,17 @@ sctp_find_ifn(void *ifn, uint32_t ifn_index)
struct sctp_ifn *sctp_ifnp;
struct sctp_ifnlist *hash_ifn_head;

/* We assume the lock is held for the addresses
* if that's wrong problems could occur :-)
*/
SCTP_IPI_ADDR_LOCK_ASSERT();
hash_ifn_head = &SCTP_BASE_INFO(vrf_ifn_hash)[(ifn_index & SCTP_BASE_INFO(vrf_ifn_hashmark))];
LIST_FOREACH(sctp_ifnp, hash_ifn_head, next_bucket) {
if (sctp_ifnp->ifn_index == ifn_index) {
return (sctp_ifnp);
break;
}
if (sctp_ifnp->ifn_p && ifn && (sctp_ifnp->ifn_p == ifn)) {
return (sctp_ifnp);
if (ifn != NULL && sctp_ifnp->ifn_p == ifn) {
break;
}
}
return (NULL);
return (sctp_ifnp);
}

struct sctp_vrf *
Expand All @@ -286,10 +283,10 @@ void
sctp_free_vrf(struct sctp_vrf *vrf)
{
if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&vrf->refcount)) {
if (vrf->vrf_addr_hash) {
SCTP_HASH_FREE(vrf->vrf_addr_hash, vrf->vrf_addr_hashmark);
vrf->vrf_addr_hash = NULL;
}
if (vrf->vrf_addr_hash) {
SCTP_HASH_FREE(vrf->vrf_addr_hash, vrf->vrf_addr_hashmark);
vrf->vrf_addr_hash = NULL;
}
/* We zero'd the count */
LIST_REMOVE(vrf, next_vrf);
SCTP_FREE(vrf, SCTP_M_VRF);
Expand All @@ -310,17 +307,6 @@ sctp_free_ifn(struct sctp_ifn *sctp_ifnp)
}
}

void
sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu)
{
struct sctp_ifn *sctp_ifnp;

sctp_ifnp = sctp_find_ifn((void *)NULL, ifn_index);
if (sctp_ifnp != NULL) {
sctp_ifnp->ifn_mtu = mtu;
}
}

void
sctp_free_ifa(struct sctp_ifa *sctp_ifap)
{
Expand Down Expand Up @@ -852,7 +838,7 @@ sctp_del_addr_from_vrf(uint32_t vrf_id, struct sockaddr *addr,
else {
SCTPDBG(SCTP_DEBUG_PCB4, "Del Addr-ifn:%d Could not find address:",
ifn_index);
SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr);
SCTPDBG_ADDR(SCTP_DEBUG_PCB4, addr);
}
#endif

Expand Down
2 changes: 0 additions & 2 deletions usrsctplib/netinet/sctp_pcb.h
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,6 @@ sctp_add_addr_to_vrf(uint32_t vrfid,
void *ifa, struct sockaddr *addr, uint32_t ifa_flags,
int dynamic_add);

void sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu);

void sctp_free_ifa(struct sctp_ifa *sctp_ifap);

void sctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,
Expand Down

0 comments on commit 1c22f31

Please sign in to comment.