---------------------------------------------------------------------- * HASH TABLE CODE * ---------------------------------------------------------------------- */ @addtogroup Hash * * The Hash functions facilitate searching the NAT Hash Tables for associations * as well as adding/removing associations from the table(s). */ @ingroup Hash * @brief Find the SCTP as
| 2010 | * @return pointer to association or NULL |
| 2011 | */ |
| 2012 | static struct sctp_nat_assoc* |
| 2013 | FindSctpLocal(struct libalias *la, struct in_addr l_addr, struct in_addr g_addr, uint32_t l_vtag, uint16_t l_port, uint16_t g_port) |
| 2014 | { |
| 2015 | u_int i; |
| 2016 | struct sctp_nat_assoc *assoc = NULL; |
| 2017 | struct sctp_GlobalAddress *G_Addr = NULL; |
| 2018 | |
| 2019 | if (l_vtag != 0) { /* an init packet, vtag==0 */ |
| 2020 | i = SN_TABLE_HASH(l_vtag, l_port, la->sctpNatTableSize); |
| 2021 | LIST_FOREACH(assoc, &la->sctpTableLocal[i], list_L) { |
| 2022 | if ((assoc->l_vtag == l_vtag) && (assoc->l_port == l_port) && (assoc->g_port == g_port)\ |
| 2023 | && (assoc->l_addr.s_addr == l_addr.s_addr)) { |
| 2024 | if (assoc->num_Gaddr) { |
| 2025 | LIST_FOREACH(G_Addr, &(assoc->Gaddr), list_Gaddr) { |
| 2026 | if (G_Addr->g_addr.s_addr == g_addr.s_addr) |
| 2027 | return (assoc); |
| 2028 | } |
| 2029 | } else { |
| 2030 | return (assoc); |
| 2031 | } |
| 2032 | } |
| 2033 | } |
| 2034 | } |
| 2035 | return (NULL); |
| 2036 | } |
| 2037 | |
| 2038 | /** @ingroup Hash |
| 2039 | * @brief Check for Global Clash |
no outgoing calls
no test coverage detected