Lines Matching refs:inp

112 in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
115 struct socket *so = inp->inp_socket;
117 struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
122 INP_WLOCK_ASSERT(inp);
127 if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
132 if ((error = prison_local_ip6(cred, &inp->in6p_laddr,
133 ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
149 ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0)
169 (inp->inp_flags & INP_BINDANY) == 0) {
199 priv_check_cred(inp->inp_cred,
211 (inp->inp_cred->cr_uid !=
215 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 &&
229 (inp->inp_cred->cr_uid !=
252 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 &&
265 INADDR_ANY || ((inp->inp_vflag &
277 inp->in6p_laddr = sin6->sin6_addr;
280 if ((error = in6_pcbsetport(&inp->in6p_laddr, inp, cred)) != 0) {
282 inp->in6p_laddr = in6addr_any;
286 inp->inp_lport = lport;
287 if (in_pcbinshash(inp) != 0) {
288 inp->in6p_laddr = in6addr_any;
289 inp->inp_lport = 0;
308 in6_pcbladdr(register struct inpcb *inp, struct sockaddr *nam,
317 INP_WLOCK_ASSERT(inp);
318 INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); /* XXXRW: why? */
340 if ((error = prison_remote_ip6(inp->inp_cred, &sin6->sin6_addr)) != 0)
343 error = in6_selectsrc(sin6, inp->in6p_outputopts,
344 inp, NULL, inp->inp_cred, &ifp, &in6a);
379 in6_pcbconnect_mbuf(register struct inpcb *inp, struct sockaddr *nam,
382 struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
387 INP_WLOCK_ASSERT(inp);
394 if ((error = in6_pcbladdr(inp, nam, &addr6)) != 0)
399 IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)
400 ? &addr6 : &inp->in6p_laddr,
401 inp->inp_lport, 0, NULL) != NULL) {
404 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
405 if (inp->inp_lport == 0) {
406 error = in6_pcbbind(inp, (struct sockaddr *)0, cred);
410 inp->in6p_laddr = addr6;
412 inp->in6p_faddr = sin6->sin6_addr;
413 inp->inp_fport = sin6->sin6_port;
415 inp->inp_flow &= ~IPV6_FLOWLABEL_MASK;
416 if (inp->inp_flags & IN6P_AUTOFLOWLABEL)
417 inp->inp_flow |=
420 in_pcbrehash_mbuf(inp, m);
426 in6_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
429 return (in6_pcbconnect_mbuf(inp, nam, cred, NULL));
433 in6_pcbdisconnect(struct inpcb *inp)
436 INP_WLOCK_ASSERT(inp);
437 INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo);
439 bzero((caddr_t)&inp->in6p_faddr, sizeof(inp->in6p_faddr));
440 inp->inp_fport = 0;
442 inp->inp_flow &= ~IPV6_FLOWLABEL_MASK;
443 in_pcbrehash(inp);
484 register struct inpcb *inp;
488 inp = sotoinpcb(so);
489 KASSERT(inp != NULL, ("in6_getsockaddr: inp == NULL"));
491 INP_RLOCK(inp);
492 port = inp->inp_lport;
493 addr = inp->in6p_laddr;
494 INP_RUNLOCK(inp);
503 struct inpcb *inp;
507 inp = sotoinpcb(so);
508 KASSERT(inp != NULL, ("in6_getpeeraddr: inp == NULL"));
510 INP_RLOCK(inp);
511 port = inp->inp_fport;
512 addr = inp->in6p_faddr;
513 INP_RUNLOCK(inp);
522 struct inpcb *inp;
525 inp = sotoinpcb(so);
526 KASSERT(inp != NULL, ("in6_mapped_sockaddr: inp == NULL"));
529 if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
546 struct inpcb *inp;
549 inp = sotoinpcb(so);
550 KASSERT(inp != NULL, ("in6_mapped_peeraddr: inp == NULL"));
553 if ((inp->inp_vflag & (INP_IPV4 | INP_IPV6)) == INP_IPV4) {
580 struct inpcb *inp, *inp_temp;
617 LIST_FOREACH_SAFE(inp, pcbinfo->ipi_listhead, inp_list, inp_temp) {
618 INP_WLOCK(inp);
619 if ((inp->inp_vflag & INP_IPV6) == 0) {
620 INP_WUNLOCK(inp);
633 if (cmd == PRC_MSGSIZE && (inp->inp_flags & IN6P_MTU) != 0 &&
634 (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) ||
635 IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, &sa6_dst->sin6_addr))) {
636 ip6_notify_pmtu(inp, (struct sockaddr_in6 *)dst,
649 inp->inp_socket != NULL &&
650 flowinfo == (inp->inp_flow & IPV6_FLOWLABEL_MASK) &&
651 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, &sa6_src.sin6_addr))
653 else if (!IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr,
655 inp->inp_socket == 0 ||
656 (lport && inp->inp_lport != lport) ||
658 !IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr,
660 (fport && inp->inp_fport != fport)) {
661 INP_WUNLOCK(inp);
667 if ((*notify)(inp, errno))
668 INP_WUNLOCK(inp);
670 INP_WUNLOCK(inp);
683 register struct inpcb *inp;
699 LIST_FOREACH(inp, head, inp_hash) {
700 /* XXX inp locking */
701 if ((inp->inp_vflag & INP_IPV6) == 0)
703 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) &&
704 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) &&
705 inp->inp_lport == lport) {
709 inp->inp_cred->cr_prison))
710 return (inp);
738 LIST_FOREACH(inp, &phd->phd_pcblist, inp_portlist) {
742 inp->inp_cred->cr_prison))
744 /* XXX inp locking */
745 if ((inp->inp_vflag & INP_IPV6) == 0)
747 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr))
750 &inp->in6p_laddr)) {
754 &inp->in6p_laddr, laddr))
761 match = inp;
834 in6_rtchange(struct inpcb *inp, int errno)
839 return inp;
852 struct inpcb *inp, *tmpinp;
869 LIST_FOREACH(inp, head, inp_pcbgrouphash) {
870 /* XXX inp locking */
871 if ((inp->inp_vflag & INP_IPV6) == 0)
873 if (IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, faddr) &&
874 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) &&
875 inp->inp_fport == fport &&
876 inp->inp_lport == lport) {
879 * the inp here, without any checks.
882 if (prison_flag(inp->inp_cred, PR_IP6))
885 tmpinp = inp;
889 inp = tmpinp;
910 LIST_FOREACH(inp, head, inp_pcbgroup_wild) {
911 /* XXX inp locking */
912 if ((inp->inp_vflag & INP_IPV6) == 0)
915 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) ||
916 inp->inp_lport != lport) {
920 /* XXX inp locking */
921 if (faith && (inp->inp_flags & INP_FAITH) == 0)
924 injail = prison_flag(inp->inp_cred, PR_IP6);
926 if (prison_check_ip6(inp->inp_cred,
934 if (IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr)) {
938 local_exact = inp;
939 } else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
941 jail_wild = inp;
943 local_wild = inp;
947 inp = jail_wild;
948 if (inp == NULL)
949 inp = jail_wild;
950 if (inp == NULL)
951 inp = local_exact;
952 if (inp == NULL)
953 inp = local_wild;
954 if (inp != NULL)
961 in_pcbref(inp);
964 INP_WLOCK(inp);
965 if (in_pcbrele_wlocked(inp))
968 INP_RLOCK(inp);
969 if (in_pcbrele_rlocked(inp))
973 return (inp);
986 struct inpcb *inp, *tmpinp;
1007 LIST_FOREACH(inp, head, inp_hash) {
1008 /* XXX inp locking */
1009 if ((inp->inp_vflag & INP_IPV6) == 0)
1011 if (IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr, faddr) &&
1012 IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr) &&
1013 inp->inp_fport == fport &&
1014 inp->inp_lport == lport) {
1017 * the inp here, without any checks.
1020 if (prison_flag(inp->inp_cred, PR_IP6))
1021 return (inp);
1023 tmpinp = inp;
1046 LIST_FOREACH(inp, head, inp_hash) {
1047 /* XXX inp locking */
1048 if ((inp->inp_vflag & INP_IPV6) == 0)
1051 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr) ||
1052 inp->inp_lport != lport) {
1056 /* XXX inp locking */
1057 if (faith && (inp->inp_flags & INP_FAITH) == 0)
1060 injail = prison_flag(inp->inp_cred, PR_IP6);
1062 if (prison_check_ip6(inp->inp_cred,
1070 if (IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr, laddr)) {
1072 return (inp);
1074 local_exact = inp;
1075 } else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
1077 jail_wild = inp;
1079 local_wild = inp;
1107 struct inpcb *inp;
1110 inp = in6_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport,
1112 if (inp != NULL) {
1113 in_pcbref(inp);
1116 INP_WLOCK(inp);
1117 if (in_pcbrele_wlocked(inp))
1120 INP_RLOCK(inp);
1121 if (in_pcbrele_rlocked(inp))
1127 return (inp);