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

Function toe_4tuple_check

freebsd/netinet/toecore.c:376–402  ·  view source on GitHub ↗

* General purpose check to see if a 4-tuple is in use by the kernel. If a TCP * header (presumably for an incoming SYN) is also provided, an existing 4-tuple * in TIME_WAIT may be assassinated freeing it up for re-use. * * Note that the TCP header must have been run through tcp_fields_to_host() or * equivalent. */

Source from the content-addressed store, hash-verified

374 * equivalent.
375 */
376int
377toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp)
378{
379 struct inpcb *inp;
380
381 if (inc->inc_flags & INC_ISIPV6) {
382 inp = in6_pcblookup(&V_tcbinfo, &inc->inc6_faddr,
383 inc->inc_fport, &inc->inc6_laddr, inc->inc_lport,
384 INPLOOKUP_WLOCKPCB, ifp);
385 } else {
386 inp = in_pcblookup(&V_tcbinfo, inc->inc_faddr, inc->inc_fport,
387 inc->inc_laddr, inc->inc_lport, INPLOOKUP_WLOCKPCB, ifp);
388 }
389 if (inp != NULL) {
390 INP_WLOCK_ASSERT(inp);
391
392 if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) {
393 if (!tcp_twcheck(inp, NULL, th, NULL, 0))
394 return (EADDRINUSE);
395 } else {
396 INP_WUNLOCK(inp);
397 return (EADDRINUSE);
398 }
399 }
400
401 return (0);
402}
403
404static void
405toe_lle_event(void *arg __unused, struct llentry *lle, int evt)

Callers

nothing calls this directly

Calls 3

in6_pcblookupFunction · 0.85
in_pcblookupFunction · 0.85
tcp_twcheckFunction · 0.85

Tested by

no test coverage detected