Lines Matching defs:inp

158 	struct inpcb *inp;
162 inp = sotoinpcb(so);
163 KASSERT(inp == NULL, ("tcp_usr_attach: inp != NULL"));
174 inp = sotoinpcb(so);
175 tp = tcp_newtcpcb(inp, NULL);
178 in_pcbfree(inp);
183 INP_WUNLOCK(inp);
199 struct inpcb *inp;
202 inp = sotoinpcb(so);
203 KASSERT(inp != NULL, ("%s: inp == NULL", __func__));
204 INP_WLOCK(inp);
205 KASSERT(so->so_pcb == inp && inp->inp_socket == so,
206 ("%s: socket %p inp %p mismatch", __func__, so, inp));
208 tp = intotcpcb(inp);
210 KASSERT(inp->inp_flags & INP_DROPPED ||
212 ("%s: inp %p not dropped or embryonic", __func__, inp));
215 in_pcbfree(inp);
226 struct inpcb *inp;
230 inp = sotoinpcb(so);
231 KASSERT(inp != NULL, ("tcp_usr_bind: inp == NULL"));
232 INP_WLOCK(inp);
233 if (inp->inp_flags & INP_DROPPED) {
234 INP_WUNLOCK(inp);
237 tp = intotcpcb(inp);
265 error = in_pcbbind(inp, sinp, td->td_ucred);
270 INP_WUNLOCK(inp);
281 struct inpcb *inp;
286 inp = sotoinpcb(so);
287 KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL"));
288 INP_WLOCK(inp);
289 if (inp->inp_flags & INP_DROPPED) {
290 INP_WUNLOCK(inp);
293 tp = intotcpcb(inp);
295 vflagsav = inp->inp_vflag;
316 inp->inp_vflag &= ~INP_IPV4;
317 inp->inp_vflag |= INP_IPV6;
319 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
321 inp->inp_vflag |= INP_IPV4;
331 inp->inp_vflag |= INP_IPV4;
332 inp->inp_vflag &= ~INP_IPV6;
333 error = in_pcbbind(inp, &sin, td->td_ucred);
339 error = in6_pcbbind(inp, sin6, td->td_ucred);
343 inp->inp_vflag = vflagsav;
346 INP_WUNLOCK(inp);
358 struct inpcb *inp;
363 inp = sotoinpcb(so);
364 KASSERT(inp != NULL, ("tcp_usr_listen: inp == NULL"));
365 INP_WLOCK(inp);
366 if (inp->inp_flags & INP_DROPPED) {
367 INP_WUNLOCK(inp);
370 tp = intotcpcb(inp);
379 if (inp->inp_lport == 0) {
381 error = in_pcbbind(inp, NULL, td->td_ucred);
399 in_pcblisten(inp);
406 INP_WUNLOCK(inp);
415 struct inpcb *inp;
421 inp = sotoinpcb(so);
422 KASSERT(inp != NULL, ("tcp6_usr_listen: inp == NULL"));
423 INP_WLOCK(inp);
424 if (inp->inp_flags & INP_DROPPED) {
425 INP_WUNLOCK(inp);
428 tp = intotcpcb(inp);
430 vflagsav = inp->inp_vflag;
440 if (inp->inp_lport == 0) {
441 inp->inp_vflag &= ~INP_IPV4;
442 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0)
443 inp->inp_vflag |= INP_IPV4;
444 error = in6_pcbbind(inp, NULL, td->td_ucred);
462 in_pcblisten(inp);
467 inp->inp_vflag = vflagsav;
472 INP_WUNLOCK(inp);
490 struct inpcb *inp;
494 inp = sotoinpcb(so);
495 KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL"));
496 INP_WLOCK(inp);
497 if (inp->inp_flags & INP_DROPPED) {
498 INP_WUNLOCK(inp);
501 tp = intotcpcb(inp);
547 INP_WUNLOCK(inp);
558 struct inpcb *inp;
564 inp = sotoinpcb(so);
565 KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL"));
566 INP_WLOCK(inp);
567 if (inp->inp_flags & INP_DROPPED) {
568 INP_WUNLOCK(inp);
571 tp = intotcpcb(inp);
573 vflagsav = inp->inp_vflag;
574 incflagsav = inp->inp_inc.inc_flags;
605 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
609 if ((inp->inp_vflag & INP_IPV4) == 0) {
626 inp->inp_vflag |= INP_IPV4;
627 inp->inp_vflag &= ~INP_IPV6;
640 if ((inp->inp_vflag & INP_IPV6) == 0) {
648 inp->inp_vflag &= ~INP_IPV4;
649 inp->inp_vflag |= INP_IPV6;
650 inp->inp_inc.inc_flags |= INC_ISIPV6;
671 if (error != 0 && inp->inp_lport == 0) {
672 inp->inp_vflag = vflagsav;
673 inp->inp_inc.inc_flags = incflagsav;
678 INP_WUNLOCK(inp);
697 struct inpcb *inp;
702 inp = sotoinpcb(so);
703 KASSERT(inp != NULL, ("tcp_usr_disconnect: inp == NULL"));
704 INP_WLOCK(inp);
705 tp = intotcpcb(inp);
713 INP_WUNLOCK(inp);
726 struct inpcb *inp;
730 inp = sotoinpcb(so);
731 KASSERT(inp != NULL, ("tcp_usr_accept: inp == NULL"));
732 INP_WLOCK(inp);
733 if (inp->inp_flags & INP_DROPPED) {
734 INP_WUNLOCK(inp);
737 tp = intotcpcb(inp);
745 .sin_port = inp->inp_fport,
746 .sin_addr = inp->inp_faddr,
750 INP_WUNLOCK(inp);
760 struct inpcb *inp;
764 inp = sotoinpcb(so);
765 KASSERT(inp != NULL, ("tcp6_usr_accept: inp == NULL"));
766 INP_WLOCK(inp);
767 if (inp->inp_flags & INP_DROPPED) {
768 INP_WUNLOCK(inp);
771 tp = intotcpcb(inp);
776 if (inp->inp_vflag & INP_IPV4) {
780 .sin_port = inp->inp_fport,
781 .sin_addr = inp->inp_faddr,
788 .sin6_port = inp->inp_fport,
789 .sin6_addr = inp->in6p_faddr,
798 INP_WUNLOCK(inp);
811 struct inpcb *inp = sotoinpcb(so);
812 struct tcpcb *tp = intotcpcb(inp);
842 INP_WLOCK(inp);
843 if (inp->inp_flags & INP_DROPPED) {
844 INP_WUNLOCK(inp);
869 struct inpcb *inp;
873 inp = sotoinpcb(so);
874 KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL"));
875 INP_WLOCK(inp);
876 if (inp->inp_flags & INP_DROPPED) {
877 INP_WUNLOCK(inp);
880 tp = intotcpcb(inp);
919 struct inpcb *inp;
935 inp = sotoinpcb(so);
936 KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL"));
937 INP_WLOCK(inp);
938 if (inp->inp_flags & INP_DROPPED) {
941 INP_WUNLOCK(inp);
944 tp = intotcpcb(inp);
946 vflagsav = inp->inp_vflag;
947 incflagsav = inp->inp_inc.inc_flags;
978 if ((inp->inp_vflag & INP_IPV6) != 0) {
1005 if ((inp->inp_vflag & INP_IPV6PROTO) == 0) {
1015 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
1019 if ((inp->inp_vflag & INP_IPV4) == 0) {
1024 inp->inp_vflag &= ~INP_IPV6;
1041 if ((inp->inp_vflag & INP_IPV6) == 0) {
1046 inp->inp_vflag &= ~INP_IPV4;
1047 inp->inp_inc.inc_flags |= INC_ISIPV6;
1089 if (error == 0 || inp->inp_lport != 0)
1122 if (!(inp->inp_flags & INP_DROPPED) &&
1180 if (error == 0 || inp->inp_lport != 0)
1199 &inp->inp_socket->so_rcv,
1200 &inp->inp_socket->so_snd,
1217 inp->inp_vflag = vflagsav;
1218 inp->inp_inc.inc_flags = incflagsav;
1233 struct inpcb *inp;
1237 inp = sotoinpcb(so);
1238 INP_WLOCK(inp);
1239 if (inp->inp_flags & INP_DROPPED) {
1240 INP_WUNLOCK(inp);
1244 tp = intotcpcb(inp);
1250 INP_WUNLOCK(inp);
1266 struct inpcb *inp;
1270 inp = sotoinpcb(so);
1271 KASSERT(inp != NULL, ("tcp_usr_abort: inp == NULL"));
1274 INP_WLOCK(inp);
1275 KASSERT(inp->inp_socket != NULL,
1281 if (!(inp->inp_flags & INP_DROPPED)) {
1282 tp = intotcpcb(inp);
1289 if (!(inp->inp_flags & INP_DROPPED)) {
1291 inp->inp_flags |= INP_SOCKREF;
1293 INP_WUNLOCK(inp);
1304 struct inpcb *inp;
1308 inp = sotoinpcb(so);
1309 KASSERT(inp != NULL, ("tcp_usr_close: inp == NULL"));
1312 INP_WLOCK(inp);
1313 KASSERT(inp->inp_socket != NULL,
1320 if (!(inp->inp_flags & INP_DROPPED)) {
1321 tp = intotcpcb(inp);
1329 if (!(inp->inp_flags & INP_DROPPED)) {
1331 inp->inp_flags |= INP_SOCKREF;
1333 INP_WUNLOCK(inp);
1362 struct inpcb *inp;
1365 inp = sotoinpcb(so);
1366 KASSERT(inp != NULL, ("tcp_usr_rcvoob: inp == NULL"));
1367 INP_WLOCK(inp);
1368 if (inp->inp_flags & INP_DROPPED) {
1369 INP_WUNLOCK(inp);
1372 tp = intotcpcb(inp);
1397 INP_WUNLOCK(inp);
1467 struct inpcb *inp = tptoinpcb(tp);
1472 INP_WLOCK_ASSERT(inp);
1480 error = in_pcbconnect(inp, sin, td->td_ucred);
1497 tp->iss = tcp_new_isn(&inp->inp_inc);
1499 tp->ts_offset = tcp_new_ts_offset(&inp->inp_inc);
1510 struct inpcb *inp = tptoinpcb(tp);
1515 INP_WLOCK_ASSERT(inp);
1522 error = in6_pcbconnect(inp, sin6, td->td_ucred, true);
1535 tp->iss = tcp_new_isn(&inp->inp_inc);
1537 tp->ts_offset = tcp_new_ts_offset(&inp->inp_inc);
1637 #define INP_WLOCK_RECHECK_CLEANUP(inp, cleanup) do { \
1638 INP_WLOCK(inp); \
1639 if (inp->inp_flags & INP_DROPPED) { \
1640 INP_WUNLOCK(inp); \
1644 tp = intotcpcb(inp); \
1646 #define INP_WLOCK_RECHECK(inp) INP_WLOCK_RECHECK_CLEANUP((inp), /* noop */)
1649 tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt)
1651 struct socket *so = inp->inp_socket;
1652 struct tcpcb *tp = intotcpcb(inp);
1656 INP_WLOCK_ASSERT(inp);
1657 KASSERT((inp->inp_flags & INP_DROPPED) == 0,
1658 ("inp_flags == %x", inp->inp_flags));
1662 INP_WUNLOCK(inp);
1664 if (inp->inp_vflag & INP_IPV6PROTO)
1681 if ((inp->inp_vflag & INP_IPV6PROTO) == 0)
1699 inp->inp_ip_tos &= ~IPTOS_ECN_MASK;
1712 INP_WLOCK_RECHECK(inp);
1722 INP_WUNLOCK(inp);
1727 INP_WLOCK_RECHECK(inp);
1731 INP_WUNLOCK(inp);
1737 INP_WUNLOCK(inp);
1742 INP_WUNLOCK(inp);
1748 INP_WUNLOCK(inp);
1807 INP_WUNLOCK(inp);
1817 tcp_ctloutput_get(struct inpcb *inp, struct sockopt *sopt)
1819 struct socket *so = inp->inp_socket;
1820 struct tcpcb *tp = intotcpcb(inp);
1824 INP_WLOCK_ASSERT(inp);
1825 KASSERT((inp->inp_flags & INP_DROPPED) == 0,
1826 ("inp_flags == %x", inp->inp_flags));
1830 INP_WUNLOCK(inp);
1832 if (inp->inp_vflag & INP_IPV6PROTO)
1857 INP_WUNLOCK(inp);
1869 struct inpcb *inp;
1871 inp = sotoinpcb(so);
1872 KASSERT(inp != NULL, ("tcp_ctloutput: inp == NULL"));
1874 INP_WLOCK(inp);
1875 if (inp->inp_flags & INP_DROPPED) {
1876 INP_WUNLOCK(inp);
1880 return (tcp_ctloutput_set(inp, sopt));
1882 return (tcp_ctloutput_get(inp, sopt));
1899 tcp_set_cc_mod(struct inpcb *inp, struct sockopt *sopt)
1909 INP_WUNLOCK(inp);
1952 INP_WLOCK(inp);
1953 if (inp->inp_flags & INP_DROPPED) {
1954 INP_WUNLOCK(inp);
1963 tp = intotcpcb(inp);
2003 INP_WUNLOCK(inp);
2014 struct inpcb *inp = tptoinpcb(tp);
2020 struct socket *so = inp->inp_socket;
2028 INP_WLOCK_ASSERT(inp);
2029 KASSERT((inp->inp_flags & INP_DROPPED) == 0,
2030 ("inp_flags == %x", inp->inp_flags));
2031 KASSERT(inp->inp_socket != NULL, ("inp_socket == NULL"));
2036 MPASS(inp->inp_vflag & INP_IPV6PROTO);
2042 INP_WUNLOCK(inp);
2047 INP_WUNLOCK(inp);
2058 INP_WUNLOCK(inp);
2068 INP_WLOCK_RECHECK_CLEANUP(inp, free(pbuf, M_TEMP));
2073 INP_WUNLOCK(inp);
2085 INP_WUNLOCK(inp);
2088 error = TCPMD5_PCBCTL(inp, sopt);
2091 INP_WLOCK_RECHECK(inp);
2097 INP_WUNLOCK(inp);
2103 INP_WLOCK_RECHECK(inp);
2127 INP_WUNLOCK(inp);
2131 INP_WUNLOCK(inp);
2137 INP_WLOCK_RECHECK(inp);
2153 INP_WUNLOCK(inp);
2167 INP_WLOCK_RECHECK(inp);
2178 INP_WUNLOCK(inp);
2184 INP_WLOCK_RECHECK(inp);
2203 INP_WUNLOCK(inp);
2208 INP_WUNLOCK(inp);
2221 INP_WLOCK_RECHECK(inp);
2228 INP_WUNLOCK(inp);
2237 error = tcp_set_cc_mod(inp, sopt);
2241 INP_WUNLOCK(inp);
2244 INP_WLOCK_RECHECK(inp);
2246 error = in_pcblbgroup_numa(inp, optval);
2247 INP_WUNLOCK(inp);
2252 INP_WUNLOCK(inp);
2260 INP_WUNLOCK(inp);
2265 INP_WLOCK_RECHECK(inp);
2267 INP_WUNLOCK(inp);
2270 INP_WUNLOCK(inp);
2282 INP_WUNLOCK(inp);
2293 INP_WLOCK_RECHECK(inp);
2328 INP_WUNLOCK(inp);
2333 INP_WLOCK_RECHECK(inp);
2344 INP_WUNLOCK(inp);
2350 INP_WLOCK_RECHECK(inp);
2364 INP_WUNLOCK(inp);
2374 INP_WLOCK_RECHECK(inp);
2414 INP_WUNLOCK(inp);
2420 INP_WLOCK_RECHECK(inp);
2425 INP_WUNLOCK(inp);
2430 INP_WUNLOCK(inp);
2435 INP_WLOCK_RECHECK(inp);
2442 INP_WUNLOCK(inp);
2448 INP_WLOCK_RECHECK(inp);
2452 INP_WUNLOCK(inp);
2464 INP_WUNLOCK(inp);
2471 tp = intotcpcb(inp);
2475 INP_WUNLOCK(inp);
2478 error = TCPMD5_PCBCTL(inp, sopt);
2484 INP_WUNLOCK(inp);
2489 INP_WUNLOCK(inp);
2494 INP_WUNLOCK(inp);
2499 INP_WUNLOCK(inp);
2504 INP_WUNLOCK(inp);
2509 INP_WUNLOCK(inp);
2528 INP_WUNLOCK(inp);
2548 INP_WLOCK_RECHECK(inp);
2551 INP_WUNLOCK(inp);
2556 INP_WUNLOCK(inp);
2563 INP_WUNLOCK(inp);
2588 INP_WUNLOCK(inp);
2597 INP_WUNLOCK(inp);
2603 INP_WUNLOCK(inp);
2609 INP_WUNLOCK(inp);
2613 /* tcp_log_getlogbuf() does INP_WUNLOCK(inp) */
2618 INP_WUNLOCK(inp);
2623 INP_WUNLOCK(inp);
2630 INP_WUNLOCK(inp);
2637 INP_WUNLOCK(inp);
2644 INP_WUNLOCK(inp);
2666 struct inpcb *inp = tptoinpcb(tp);
2670 INP_WLOCK_ASSERT(inp);
2689 if (!(inp->inp_flags & INP_DROPPED))