@ingroup Hash * @brief Check for Global Clash * * Searches the global look-up table for the association entry matching the * provided global <(addresses):ports:vtag> tuple * * @param la Pointer to the relevant libalias instance * @param Cassoc association being checked for a clash * * @return pointer to association or NULL */
| 2047 | * @return pointer to association or NULL |
| 2048 | */ |
| 2049 | static struct sctp_nat_assoc* |
| 2050 | FindSctpGlobalClash(struct libalias *la, struct sctp_nat_assoc *Cassoc) |
| 2051 | { |
| 2052 | u_int i; |
| 2053 | struct sctp_nat_assoc *assoc = NULL; |
| 2054 | struct sctp_GlobalAddress *G_Addr = NULL; |
| 2055 | struct sctp_GlobalAddress *G_AddrC = NULL; |
| 2056 | |
| 2057 | if (Cassoc->g_vtag != 0) { /* an init packet, vtag==0 */ |
| 2058 | i = SN_TABLE_HASH(Cassoc->g_vtag, Cassoc->g_port, la->sctpNatTableSize); |
| 2059 | LIST_FOREACH(assoc, &la->sctpTableGlobal[i], list_G) { |
| 2060 | if ((assoc->g_vtag == Cassoc->g_vtag) && (assoc->g_port == Cassoc->g_port) && (assoc->l_port == Cassoc->l_port)) { |
| 2061 | if (assoc->num_Gaddr) { |
| 2062 | LIST_FOREACH(G_AddrC, &(Cassoc->Gaddr), list_Gaddr) { |
| 2063 | LIST_FOREACH(G_Addr, &(assoc->Gaddr), list_Gaddr) { |
| 2064 | if (G_Addr->g_addr.s_addr == G_AddrC->g_addr.s_addr) |
| 2065 | return (assoc); |
| 2066 | } |
| 2067 | } |
| 2068 | } else { |
| 2069 | return (assoc); |
| 2070 | } |
| 2071 | } |
| 2072 | } |
| 2073 | } |
| 2074 | return (NULL); |
| 2075 | } |
| 2076 | |
| 2077 | /** @ingroup Hash |
| 2078 | * @brief Find the SCTP association given the global port and vtag |
no outgoing calls
no test coverage detected