Lines Matching refs:inp

138 	struct inpcb *inp;
143 inp = sotoinpcb(so);
144 KASSERT(inp == NULL, ("tcp_usr_attach: inp != NULL"));
154 inp = sotoinpcb(so);
155 tp = intotcpcb(inp);
172 tcp_detach(struct socket *so, struct inpcb *inp)
177 INP_WLOCK_ASSERT(inp);
179 KASSERT(so->so_pcb == inp, ("tcp_detach: so_pcb != inp"));
180 KASSERT(inp->inp_socket == so, ("tcp_detach: inp_socket != so"));
182 tp = intotcpcb(inp);
184 if (inp->inp_flags & INP_TIMEWAIT) {
212 if (inp->inp_flags & INP_DROPPED) {
215 in_pcbdetach(inp);
216 in_pcbfree(inp);
218 in_pcbdetach(inp);
219 INP_WUNLOCK(inp);
231 if (inp->inp_flags & INP_DROPPED ||
234 in_pcbdetach(inp);
235 in_pcbfree(inp);
237 in_pcbdetach(inp);
238 INP_WUNLOCK(inp);
253 struct inpcb *inp;
256 inp = sotoinpcb(so);
257 KASSERT(inp != NULL, ("tcp_usr_detach: inp == NULL"));
262 INP_WLOCK(inp);
263 KASSERT(inp->inp_socket != NULL,
265 tcp_detach(so, inp);
278 struct inpcb *inp;
294 inp = sotoinpcb(so);
295 KASSERT(inp != NULL, ("tcp_usr_bind: inp == NULL"));
296 INP_WLOCK(inp);
297 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
301 tp = intotcpcb(inp);
304 error = in_pcbbind(inp, nam, td->td_ucred);
309 INP_WUNLOCK(inp);
320 struct inpcb *inp;
336 inp = sotoinpcb(so);
337 KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL"));
338 INP_WLOCK(inp);
339 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
343 tp = intotcpcb(inp);
346 inp->inp_vflag &= ~INP_IPV4;
347 inp->inp_vflag |= INP_IPV6;
349 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
351 inp->inp_vflag |= INP_IPV4;
356 inp->inp_vflag |= INP_IPV4;
357 inp->inp_vflag &= ~INP_IPV6;
358 error = in_pcbbind(inp, (struct sockaddr *)&sin,
365 error = in6_pcbbind(inp, nam, td->td_ucred);
370 INP_WUNLOCK(inp);
383 struct inpcb *inp;
387 inp = sotoinpcb(so);
388 KASSERT(inp != NULL, ("tcp_usr_listen: inp == NULL"));
389 INP_WLOCK(inp);
390 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
394 tp = intotcpcb(inp);
399 if (error == 0 && inp->inp_lport == 0)
400 error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
419 INP_WUNLOCK(inp);
429 struct inpcb *inp;
433 inp = sotoinpcb(so);
434 KASSERT(inp != NULL, ("tcp6_usr_listen: inp == NULL"));
435 INP_WLOCK(inp);
436 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
440 tp = intotcpcb(inp);
445 if (error == 0 && inp->inp_lport == 0) {
446 inp->inp_vflag &= ~INP_IPV4;
447 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0)
448 inp->inp_vflag |= INP_IPV4;
449 error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
469 INP_WUNLOCK(inp);
486 struct inpcb *inp;
503 inp = sotoinpcb(so);
504 KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL"));
505 INP_WLOCK(inp);
506 if (inp->inp_flags & INP_TIMEWAIT) {
510 if (inp->inp_flags & INP_DROPPED) {
514 tp = intotcpcb(inp);
529 INP_WUNLOCK(inp);
539 struct inpcb *inp;
555 inp = sotoinpcb(so);
556 KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL"));
557 INP_WLOCK(inp);
558 if (inp->inp_flags & INP_TIMEWAIT) {
562 if (inp->inp_flags & INP_DROPPED) {
566 tp = intotcpcb(inp);
577 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
583 inp->inp_vflag |= INP_IPV4;
584 inp->inp_vflag &= ~INP_IPV6;
600 inp->inp_vflag &= ~INP_IPV4;
601 inp->inp_vflag |= INP_IPV6;
602 inp->inp_inc.inc_flags |= INC_ISIPV6;
619 INP_WUNLOCK(inp);
638 struct inpcb *inp;
644 inp = sotoinpcb(so);
645 KASSERT(inp != NULL, ("tcp_usr_disconnect: inp == NULL"));
646 INP_WLOCK(inp);
647 if (inp->inp_flags & INP_TIMEWAIT)
649 if (inp->inp_flags & INP_DROPPED) {
653 tp = intotcpcb(inp);
659 INP_WUNLOCK(inp);
673 struct inpcb *inp = NULL;
682 inp = sotoinpcb(so);
683 KASSERT(inp != NULL, ("tcp_usr_accept: inp == NULL"));
684 INP_WLOCK(inp);
685 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
689 tp = intotcpcb(inp);
697 port = inp->inp_fport;
698 addr = inp->inp_faddr;
703 INP_WUNLOCK(inp);
714 struct inpcb *inp = NULL;
726 inp = sotoinpcb(so);
727 KASSERT(inp != NULL, ("tcp6_usr_accept: inp == NULL"));
729 INP_WLOCK(inp);
730 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
734 tp = intotcpcb(inp);
742 if (inp->inp_vflag & INP_IPV4) {
744 port = inp->inp_fport;
745 addr = inp->inp_faddr;
747 port = inp->inp_fport;
748 addr6 = inp->in6p_faddr;
754 INP_WUNLOCK(inp);
773 struct inpcb *inp;
778 inp = sotoinpcb(so);
779 KASSERT(inp != NULL, ("inp == NULL"));
780 INP_WLOCK(inp);
781 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
785 tp = intotcpcb(inp);
789 if (!(inp->inp_flags & INP_DROPPED))
795 INP_WUNLOCK(inp);
807 struct inpcb *inp;
812 inp = sotoinpcb(so);
813 KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL"));
814 INP_WLOCK(inp);
815 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
819 tp = intotcpcb(inp);
843 INP_WUNLOCK(inp);
859 struct inpcb *inp;
872 inp = sotoinpcb(so);
873 KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL"));
874 INP_WLOCK(inp);
875 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
890 tp = intotcpcb(inp);
935 if (!(inp->inp_flags & INP_DROPPED) &&
997 INP_WUNLOCK(inp);
1006 struct inpcb *inp;
1010 inp = sotoinpcb(so);
1011 INP_WLOCK(inp);
1012 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
1013 INP_WUNLOCK(inp);
1018 tp = intotcpcb(inp);
1025 INP_WUNLOCK(inp);
1036 struct inpcb *inp;
1040 inp = sotoinpcb(so);
1041 KASSERT(inp != NULL, ("tcp_usr_abort: inp == NULL"));
1044 INP_WLOCK(inp);
1045 KASSERT(inp->inp_socket != NULL,
1051 if (!(inp->inp_flags & INP_TIMEWAIT) &&
1052 !(inp->inp_flags & INP_DROPPED)) {
1053 tp = intotcpcb(inp);
1059 if (!(inp->inp_flags & INP_DROPPED)) {
1063 inp->inp_flags |= INP_SOCKREF;
1065 INP_WUNLOCK(inp);
1075 struct inpcb *inp;
1079 inp = sotoinpcb(so);
1080 KASSERT(inp != NULL, ("tcp_usr_close: inp == NULL"));
1083 INP_WLOCK(inp);
1084 KASSERT(inp->inp_socket != NULL,
1091 if (!(inp->inp_flags & INP_TIMEWAIT) &&
1092 !(inp->inp_flags & INP_DROPPED)) {
1093 tp = intotcpcb(inp);
1099 if (!(inp->inp_flags & INP_DROPPED)) {
1103 inp->inp_flags |= INP_SOCKREF;
1105 INP_WUNLOCK(inp);
1116 struct inpcb *inp;
1120 inp = sotoinpcb(so);
1121 KASSERT(inp != NULL, ("tcp_usr_rcvoob: inp == NULL"));
1122 INP_WLOCK(inp);
1123 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
1127 tp = intotcpcb(inp);
1148 INP_WUNLOCK(inp);
1212 struct inpcb *inp = tp->t_inpcb, *oinp;
1213 struct socket *so = inp->inp_socket;
1218 INP_WLOCK_ASSERT(inp);
1221 if (inp->inp_lport == 0) {
1222 error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
1232 laddr = inp->inp_laddr;
1233 lport = inp->inp_lport;
1234 error = in_pcbconnect_setup(inp, nam, &laddr.s_addr, &lport,
1235 &inp->inp_faddr.s_addr, &inp->inp_fport, &oinp, td->td_ucred);
1242 inp->inp_laddr = laddr;
1243 in_pcbrehash(inp);
1273 struct inpcb *inp = tp->t_inpcb;
1276 INP_WLOCK_ASSERT(inp);
1279 if (inp->inp_lport == 0) {
1280 error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
1284 error = in6_pcbconnect(inp, nam, td->td_ucred);
1294 soisconnecting(inp->inp_socket);
1364 #define INP_WLOCK_RECHECK_CLEANUP(inp, cleanup) do { \
1365 INP_WLOCK(inp); \
1366 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \
1367 INP_WUNLOCK(inp); \
1371 tp = intotcpcb(inp); \
1373 #define INP_WLOCK_RECHECK(inp) INP_WLOCK_RECHECK_CLEANUP((inp), /* noop */)
1379 struct inpcb *inp;
1385 inp = sotoinpcb(so);
1386 KASSERT(inp != NULL, ("tcp_ctloutput: inp == NULL"));
1387 INP_WLOCK(inp);
1390 if (inp->inp_vflag & INP_IPV6PROTO) {
1391 INP_WUNLOCK(inp);
1400 INP_WUNLOCK(inp);
1406 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
1407 INP_WUNLOCK(inp);
1410 tp = intotcpcb(inp);
1417 INP_WUNLOCK(inp);
1422 INP_WLOCK_RECHECK(inp);
1431 INP_WUNLOCK(inp);
1436 INP_WUNLOCK(inp);
1442 INP_WUNLOCK(inp);
1464 INP_WUNLOCK(inp);
1470 INP_WUNLOCK(inp);
1475 return (tp->t_fb->tfb_tcp_ctloutput(so, sopt, inp, tp));
1479 tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp)
1494 INP_WUNLOCK(inp);
1502 INP_WLOCK_RECHECK_CLEANUP(inp, free(pbuf, M_TEMP));
1507 INP_WUNLOCK(inp);
1519 INP_WUNLOCK(inp);
1525 INP_WLOCK_RECHECK(inp);
1535 INP_WUNLOCK(inp);
1541 INP_WLOCK_RECHECK(inp);
1565 INP_WUNLOCK(inp);
1569 INP_WUNLOCK(inp);
1575 INP_WLOCK_RECHECK(inp);
1586 INP_WUNLOCK(inp);
1592 INP_WLOCK_RECHECK(inp);
1601 INP_WUNLOCK(inp);
1606 INP_WUNLOCK(inp);
1611 INP_WLOCK_RECHECK(inp);
1619 INP_WUNLOCK(inp);
1644 INP_WUNLOCK(inp);
1650 INP_WUNLOCK(inp);
1661 INP_WLOCK_RECHECK(inp);
1692 INP_WUNLOCK(inp);
1697 INP_WLOCK_RECHECK(inp);
1708 INP_WUNLOCK(inp);
1714 INP_WLOCK_RECHECK(inp);
1726 INP_WUNLOCK(inp);
1735 INP_WLOCK_RECHECK(inp);
1748 INP_WUNLOCK(inp);
1755 tp = intotcpcb(inp);
1760 INP_WUNLOCK(inp);
1767 INP_WUNLOCK(inp);
1772 INP_WUNLOCK(inp);
1777 INP_WUNLOCK(inp);
1782 INP_WUNLOCK(inp);
1787 INP_WUNLOCK(inp);
1792 INP_WUNLOCK(inp);
1813 INP_WUNLOCK(inp);
1821 INP_WUNLOCK(inp);
1829 INP_WUNLOCK(inp);
1834 INP_WUNLOCK(inp);
1854 struct inpcb *inp;
1870 inp = sotoinpcb(so);
1872 if (inp->inp_vflag & INP_IPV6PROTO) {
1873 inp->inp_vflag |= INP_IPV6;
1874 inp->in6p_hops = -1; /* use kernel default */
1878 inp->inp_vflag |= INP_IPV4;
1879 tp = tcp_newtcpcb(inp);
1881 in_pcbdetach(inp);
1882 in_pcbfree(inp);
1887 INP_WUNLOCK(inp);
1904 struct inpcb *inp = tp->t_inpcb;
1905 struct socket *so = inp->inp_socket;
1908 INP_WLOCK_ASSERT(inp);
1926 if (!(inp->inp_flags & INP_DROPPED))