* 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. */
| 374 | * equivalent. |
| 375 | */ |
| 376 | int |
| 377 | toe_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 | |
| 404 | static void |
| 405 | toe_lle_event(void *arg __unused, struct llentry *lle, int evt) |
nothing calls this directly
no test coverage detected