* TCP socket is closed. Start friendly disconnect. */
| 1423 | * TCP socket is closed. Start friendly disconnect. |
| 1424 | */ |
| 1425 | static void |
| 1426 | tcp_usr_close(struct socket *so) |
| 1427 | { |
| 1428 | struct inpcb *inp; |
| 1429 | struct tcpcb *tp = NULL; |
| 1430 | struct epoch_tracker et; |
| 1431 | TCPDEBUG0; |
| 1432 | |
| 1433 | inp = sotoinpcb(so); |
| 1434 | KASSERT(inp != NULL, ("tcp_usr_close: inp == NULL")); |
| 1435 | |
| 1436 | NET_EPOCH_ENTER(et); |
| 1437 | INP_WLOCK(inp); |
| 1438 | KASSERT(inp->inp_socket != NULL, |
| 1439 | ("tcp_usr_close: inp_socket == NULL")); |
| 1440 | |
| 1441 | /* |
| 1442 | * If we still have full TCP state, and we're not dropped, initiate |
| 1443 | * a disconnect. |
| 1444 | */ |
| 1445 | if (!(inp->inp_flags & INP_TIMEWAIT) && |
| 1446 | !(inp->inp_flags & INP_DROPPED)) { |
| 1447 | tp = intotcpcb(inp); |
| 1448 | TCPDEBUG1(); |
| 1449 | tcp_disconnect(tp); |
| 1450 | TCPDEBUG2(PRU_CLOSE); |
| 1451 | TCP_PROBE2(debug__user, tp, PRU_CLOSE); |
| 1452 | } |
| 1453 | if (!(inp->inp_flags & INP_DROPPED)) { |
| 1454 | SOCK_LOCK(so); |
| 1455 | so->so_state |= SS_PROTOREF; |
| 1456 | SOCK_UNLOCK(so); |
| 1457 | inp->inp_flags |= INP_SOCKREF; |
| 1458 | } |
| 1459 | INP_WUNLOCK(inp); |
| 1460 | NET_EPOCH_EXIT(et); |
| 1461 | } |
| 1462 | |
| 1463 | static int |
| 1464 | tcp_pru_options_support(struct tcpcb *tp, int flags) |
nothing calls this directly
no test coverage detected