MCPcopy Create free account
hub / github.com/F-Stack/f-stack / FindSctpGlobal

Function FindSctpGlobal

freebsd/netinet/libalias/alias_sctp.c:2096–2121  ·  view source on GitHub ↗

@ingroup Hash * @brief Find the SCTP association given the global port and vtag * * Searches the global look-up table for the association entry matching the * provided global tuple * * If all but the global address match it sets partial_match to 1 to indicate a * partial match. If the NAT is tracking global IP addresses for this * association, the NAT may respond with

Source from the content-addressed store, hash-verified

2094 * @return pointer to association or NULL
2095 */
2096static struct sctp_nat_assoc*
2097FindSctpGlobal(struct libalias *la, struct in_addr g_addr, uint32_t g_vtag, uint16_t g_port, uint16_t l_port, int *partial_match)
2098{
2099 u_int i;
2100 struct sctp_nat_assoc *assoc = NULL;
2101 struct sctp_GlobalAddress *G_Addr = NULL;
2102
2103 *partial_match = 0;
2104 if (g_vtag != 0) { /* an init packet, vtag==0 */
2105 i = SN_TABLE_HASH(g_vtag, g_port, la->sctpNatTableSize);
2106 LIST_FOREACH(assoc, &la->sctpTableGlobal[i], list_G) {
2107 if ((assoc->g_vtag == g_vtag) && (assoc->g_port == g_port) && (assoc->l_port == l_port)) {
2108 *partial_match = 1;
2109 if (assoc->num_Gaddr) {
2110 LIST_FOREACH(G_Addr, &(assoc->Gaddr), list_Gaddr) {
2111 if (G_Addr->g_addr.s_addr == g_addr.s_addr)
2112 return (assoc);
2113 }
2114 } else {
2115 return (assoc);
2116 }
2117 }
2118 }
2119 }
2120 return (NULL);
2121}
2122
2123/** @ingroup Hash
2124 * @brief Find the SCTP association for a T-Flag message (given the global port and local vtag)

Callers 1

sctp_PktParserFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected