* Drop a TCP connection, reporting * the specified error. If connection is synchronized, * then send a RST to peer. */
| 1891 | * then send a RST to peer. |
| 1892 | */ |
| 1893 | struct tcpcb * |
| 1894 | tcp_drop(struct tcpcb *tp, int errno) |
| 1895 | { |
| 1896 | struct socket *so = tp->t_inpcb->inp_socket; |
| 1897 | |
| 1898 | NET_EPOCH_ASSERT(); |
| 1899 | INP_INFO_LOCK_ASSERT(&V_tcbinfo); |
| 1900 | INP_WLOCK_ASSERT(tp->t_inpcb); |
| 1901 | |
| 1902 | if (TCPS_HAVERCVDSYN(tp->t_state)) { |
| 1903 | tcp_state_change(tp, TCPS_CLOSED); |
| 1904 | (void) tp->t_fb->tfb_tcp_output(tp); |
| 1905 | TCPSTAT_INC(tcps_drops); |
| 1906 | } else |
| 1907 | TCPSTAT_INC(tcps_conndrops); |
| 1908 | if (errno == ETIMEDOUT && tp->t_softerror) |
| 1909 | errno = tp->t_softerror; |
| 1910 | so->so_error = errno; |
| 1911 | return (tcp_close(tp)); |
| 1912 | } |
| 1913 | |
| 1914 | void |
| 1915 | tcp_discardcb(struct tcpcb *tp) |
no test coverage detected