Lines Matching refs:inp

128 	struct inpcb *inp;
133 inp = sotoinpcb(so);
134 KASSERT(inp == NULL, ("tcp_usr_attach: inp != NULL"));
144 inp = sotoinpcb(so);
145 tp = intotcpcb(inp);
161 tcp_detach(struct socket *so, struct inpcb *inp)
166 INP_WLOCK_ASSERT(inp);
168 KASSERT(so->so_pcb == inp, ("tcp_detach: so_pcb != inp"));
169 KASSERT(inp->inp_socket == so, ("tcp_detach: inp_socket != so"));
171 tp = intotcpcb(inp);
173 if (inp->inp_flags & INP_TIMEWAIT) {
201 if (inp->inp_flags & INP_DROPPED) {
204 in_pcbdetach(inp);
205 in_pcbfree(inp);
207 in_pcbdetach(inp);
208 INP_WUNLOCK(inp);
220 if (inp->inp_flags & INP_DROPPED ||
223 in_pcbdetach(inp);
224 in_pcbfree(inp);
226 in_pcbdetach(inp);
227 INP_WUNLOCK(inp);
242 struct inpcb *inp;
244 inp = sotoinpcb(so);
245 KASSERT(inp != NULL, ("tcp_usr_detach: inp == NULL"));
247 INP_WLOCK(inp);
248 KASSERT(inp->inp_socket != NULL,
250 tcp_detach(so, inp);
262 struct inpcb *inp;
278 inp = sotoinpcb(so);
279 KASSERT(inp != NULL, ("tcp_usr_bind: inp == NULL"));
280 INP_WLOCK(inp);
281 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
285 tp = intotcpcb(inp);
288 error = in_pcbbind(inp, nam, td->td_ucred);
292 INP_WUNLOCK(inp);
303 struct inpcb *inp;
319 inp = sotoinpcb(so);
320 KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL"));
321 INP_WLOCK(inp);
322 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
326 tp = intotcpcb(inp);
329 inp->inp_vflag &= ~INP_IPV4;
330 inp->inp_vflag |= INP_IPV6;
332 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
334 inp->inp_vflag |= INP_IPV4;
339 inp->inp_vflag |= INP_IPV4;
340 inp->inp_vflag &= ~INP_IPV6;
341 error = in_pcbbind(inp, (struct sockaddr *)&sin,
348 error = in6_pcbbind(inp, nam, td->td_ucred);
352 INP_WUNLOCK(inp);
365 struct inpcb *inp;
369 inp = sotoinpcb(so);
370 KASSERT(inp != NULL, ("tcp_usr_listen: inp == NULL"));
371 INP_WLOCK(inp);
372 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
376 tp = intotcpcb(inp);
381 if (error == 0 && inp->inp_lport == 0)
382 error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
396 INP_WUNLOCK(inp);
406 struct inpcb *inp;
410 inp = sotoinpcb(so);
411 KASSERT(inp != NULL, ("tcp6_usr_listen: inp == NULL"));
412 INP_WLOCK(inp);
413 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
417 tp = intotcpcb(inp);
422 if (error == 0 && inp->inp_lport == 0) {
423 inp->inp_vflag &= ~INP_IPV4;
424 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0)
425 inp->inp_vflag |= INP_IPV4;
426 error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
441 INP_WUNLOCK(inp);
458 struct inpcb *inp;
475 inp = sotoinpcb(so);
476 KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL"));
477 INP_WLOCK(inp);
478 if (inp->inp_flags & INP_TIMEWAIT) {
482 if (inp->inp_flags & INP_DROPPED) {
486 tp = intotcpcb(inp);
500 INP_WUNLOCK(inp);
510 struct inpcb *inp;
526 inp = sotoinpcb(so);
527 KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL"));
528 INP_WLOCK(inp);
529 if (inp->inp_flags & INP_TIMEWAIT) {
533 if (inp->inp_flags & INP_DROPPED) {
537 tp = intotcpcb(inp);
548 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
554 inp->inp_vflag |= INP_IPV4;
555 inp->inp_vflag &= ~INP_IPV6;
571 inp->inp_vflag &= ~INP_IPV4;
572 inp->inp_vflag |= INP_IPV6;
573 inp->inp_inc.inc_flags |= INC_ISIPV6;
589 INP_WUNLOCK(inp);
608 struct inpcb *inp;
614 inp = sotoinpcb(so);
615 KASSERT(inp != NULL, ("tcp_usr_disconnect: inp == NULL"));
616 INP_WLOCK(inp);
617 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
621 tp = intotcpcb(inp);
626 INP_WUNLOCK(inp);
647 struct inpcb *inp = NULL;
656 inp = sotoinpcb(so);
657 KASSERT(inp != NULL, ("tcp_usr_accept: inp == NULL"));
659 INP_WLOCK(inp);
660 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
664 tp = intotcpcb(inp);
672 port = inp->inp_fport;
673 addr = inp->inp_faddr;
677 INP_WUNLOCK(inp);
689 struct inpcb *inp = NULL;
701 inp = sotoinpcb(so);
702 KASSERT(inp != NULL, ("tcp6_usr_accept: inp == NULL"));
704 INP_WLOCK(inp);
705 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
709 tp = intotcpcb(inp);
717 if (inp->inp_vflag & INP_IPV4) {
719 port = inp->inp_fport;
720 addr = inp->inp_faddr;
722 port = inp->inp_fport;
723 addr6 = inp->in6p_faddr;
728 INP_WUNLOCK(inp);
747 struct inpcb *inp;
752 inp = sotoinpcb(so);
753 KASSERT(inp != NULL, ("inp == NULL"));
754 INP_WLOCK(inp);
755 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
759 tp = intotcpcb(inp);
763 if (!(inp->inp_flags & INP_DROPPED))
768 INP_WUNLOCK(inp);
780 struct inpcb *inp;
785 inp = sotoinpcb(so);
786 KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL"));
787 INP_WLOCK(inp);
788 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
792 tp = intotcpcb(inp);
803 INP_WUNLOCK(inp);
819 struct inpcb *inp;
832 inp = sotoinpcb(so);
833 KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL"));
834 INP_WLOCK(inp);
835 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
846 tp = intotcpcb(inp);
892 if (!(inp->inp_flags & INP_DROPPED)) {
950 INP_WUNLOCK(inp);
962 struct inpcb *inp;
966 inp = sotoinpcb(so);
967 KASSERT(inp != NULL, ("tcp_usr_abort: inp == NULL"));
970 INP_WLOCK(inp);
971 KASSERT(inp->inp_socket != NULL,
977 if (!(inp->inp_flags & INP_TIMEWAIT) &&
978 !(inp->inp_flags & INP_DROPPED)) {
979 tp = intotcpcb(inp);
984 if (!(inp->inp_flags & INP_DROPPED)) {
988 inp->inp_flags |= INP_SOCKREF;
990 INP_WUNLOCK(inp);
1000 struct inpcb *inp;
1004 inp = sotoinpcb(so);
1005 KASSERT(inp != NULL, ("tcp_usr_close: inp == NULL"));
1008 INP_WLOCK(inp);
1009 KASSERT(inp->inp_socket != NULL,
1016 if (!(inp->inp_flags & INP_TIMEWAIT) &&
1017 !(inp->inp_flags & INP_DROPPED)) {
1018 tp = intotcpcb(inp);
1023 if (!(inp->inp_flags & INP_DROPPED)) {
1027 inp->inp_flags |= INP_SOCKREF;
1029 INP_WUNLOCK(inp);
1040 struct inpcb *inp;
1044 inp = sotoinpcb(so);
1045 KASSERT(inp != NULL, ("tcp_usr_rcvoob: inp == NULL"));
1046 INP_WLOCK(inp);
1047 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
1051 tp = intotcpcb(inp);
1071 INP_WUNLOCK(inp);
1133 struct inpcb *inp = tp->t_inpcb, *oinp;
1134 struct socket *so = inp->inp_socket;
1139 INP_WLOCK_ASSERT(inp);
1142 if (inp->inp_lport == 0) {
1143 error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
1153 laddr = inp->inp_laddr;
1154 lport = inp->inp_lport;
1155 error = in_pcbconnect_setup(inp, nam, &laddr.s_addr, &lport,
1156 &inp->inp_faddr.s_addr, &inp->inp_fport, &oinp, td->td_ucred);
1163 inp->inp_laddr = laddr;
1164 in_pcbrehash(inp);
1194 struct inpcb *inp = tp->t_inpcb, *oinp;
1195 struct socket *so = inp->inp_socket;
1200 INP_WLOCK_ASSERT(inp);
1203 if (inp->inp_lport == 0) {
1204 error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred);
1218 error = in6_pcbladdr(inp, nam, &addr6);
1221 oinp = in6_pcblookup_hash_locked(inp->inp_pcbinfo,
1223 IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)
1225 : &inp->in6p_laddr,
1226 inp->inp_lport, 0, NULL);
1231 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
1232 inp->in6p_laddr = addr6;
1233 inp->in6p_faddr = sin6->sin6_addr;
1234 inp->inp_fport = sin6->sin6_port;
1236 inp->inp_flow &= ~IPV6_FLOWLABEL_MASK;
1237 if (inp->inp_flags & IN6P_AUTOFLOWLABEL)
1238 inp->inp_flow |=
1240 in_pcbrehash(inp);
1318 #define INP_WLOCK_RECHECK(inp) do { \
1319 INP_WLOCK(inp); \
1320 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \
1321 INP_WUNLOCK(inp); \
1324 tp = intotcpcb(inp); \
1332 struct inpcb *inp;
1339 inp = sotoinpcb(so);
1340 KASSERT(inp != NULL, ("tcp_ctloutput: inp == NULL"));
1341 INP_WLOCK(inp);
1344 if (inp->inp_vflag & INP_IPV6PROTO) {
1345 INP_WUNLOCK(inp);
1354 INP_WUNLOCK(inp);
1360 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
1361 INP_WUNLOCK(inp);
1370 INP_WUNLOCK(inp);
1376 INP_WLOCK_RECHECK(inp);
1386 INP_WUNLOCK(inp);
1392 INP_WLOCK_RECHECK(inp);
1416 INP_WUNLOCK(inp);
1420 INP_WUNLOCK(inp);
1426 INP_WLOCK_RECHECK(inp);
1437 INP_WUNLOCK(inp);
1443 INP_WLOCK_RECHECK(inp);
1452 INP_WUNLOCK(inp);
1457 INP_WUNLOCK(inp);
1462 INP_WLOCK_RECHECK(inp);
1506 INP_WUNLOCK(inp);
1517 INP_WLOCK_RECHECK(inp);
1548 INP_WUNLOCK(inp);
1553 INP_WLOCK_RECHECK(inp);
1562 INP_WUNLOCK(inp);
1569 tp = intotcpcb(inp);
1574 INP_WUNLOCK(inp);
1581 INP_WUNLOCK(inp);
1586 INP_WUNLOCK(inp);
1591 INP_WUNLOCK(inp);
1596 INP_WUNLOCK(inp);
1601 INP_WUNLOCK(inp);
1607 INP_WUNLOCK(inp);
1628 INP_WUNLOCK(inp);
1632 INP_WUNLOCK(inp);
1651 struct inpcb *inp;
1667 inp = sotoinpcb(so);
1669 if (inp->inp_vflag & INP_IPV6PROTO) {
1670 inp->inp_vflag |= INP_IPV6;
1671 inp->in6p_hops = -1; /* use kernel default */
1675 inp->inp_vflag |= INP_IPV4;
1676 tp = tcp_newtcpcb(inp);
1678 in_pcbdetach(inp);
1679 in_pcbfree(inp);
1684 INP_WUNLOCK(inp);
1700 struct inpcb *inp = tp->t_inpcb;
1701 struct socket *so = inp->inp_socket;
1704 INP_WLOCK_ASSERT(inp);
1722 if (!(inp->inp_flags & INP_DROPPED))