Lines Matching refs:inp

134 udp6_append(struct inpcb *inp, struct mbuf *n, int off,
141 INP_LOCK_ASSERT(inp);
146 up = intoudpcb(inp);
148 in_pcbref(inp);
149 INP_RUNLOCK(inp);
150 (*up->u_tun_func)(n, off, inp, (struct sockaddr *)fromsa,
152 INP_RLOCK(inp);
153 return (in_pcbrele_rlocked(inp));
158 if (IPSEC_CHECK_POLICY(ipv6, n, inp) != 0) {
165 if (mac_inpcb_check_deliver(inp, n) != 0) {
171 if (inp->inp_flags & INP_CONTROLOPTS ||
172 inp->inp_socket->so_options & SO_TIMESTAMP)
173 ip6_savecontrol(inp, n, &opts);
176 so = inp->inp_socket;
197 struct inpcb *inp;
305 LIST_FOREACH(inp, pcblist, inp_list) {
306 if ((inp->inp_vflag & INP_IPV6) == 0)
308 if (inp->inp_lport != uh->uh_dport)
310 if (inp->inp_fport != 0 &&
311 inp->inp_fport != uh->uh_sport)
313 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
314 if (!IN6_ARE_ADDR_EQUAL(&inp->in6p_laddr,
318 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
319 if (!IN6_ARE_ADDR_EQUAL(&inp->in6p_faddr,
321 inp->inp_fport != uh->uh_sport)
336 imo = inp->in6p_moptions;
341 INP_RLOCK(inp);
357 INP_RUNLOCK(inp); /* XXX */
361 INP_RUNLOCK(inp);
375 last = inp;
424 inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_src,
427 if (!inp) {
433 inp = in6_pcblookup(pcbinfo, &ip6->ip6_src,
443 inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_src,
447 if (inp == NULL) {
471 INP_RLOCK_ASSERT(inp);
472 up = intoudpcb(inp);
475 INP_RUNLOCK(inp);
480 UDP_PROBE(receive, NULL, inp, ip6, inp, uh);
481 if (udp6_append(inp, m, off, &fromsa) == 0)
482 INP_RUNLOCK(inp);
553 struct inpcb *inp;
554 inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_dst,
558 if (inp != NULL) {
561 up = intoudpcb(inp);
564 INP_RUNLOCK(inp);
570 INP_RUNLOCK(inp);
601 struct inpcb *inp;
619 inp = in6_pcblookup(&V_udbinfo, &addrs[1].sin6_addr,
622 if (inp != NULL) {
623 INP_RLOCK_ASSERT(inp);
624 if (inp->inp_socket == NULL)
628 inp->inp_socket);
630 cru2x(inp->inp_cred, &xuc);
631 INP_RUNLOCK(inp);
643 udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
663 INP_WLOCK_ASSERT(inp);
664 INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo);
688 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
692 inp->in6p_outputopts, td->td_ucred, nxt)) != 0)
696 optp = inp->in6p_outputopts;
712 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
721 if ((inp->inp_flags & IN6P_IPV6_V6ONLY)) {
735 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) &&
736 !IN6_IS_ADDR_V4MAPPED(&inp->in6p_laddr)) {
751 error = in6_selectsrc_socket(sin6, optp, inp,
757 laddr = &inp->in6p_laddr; /* XXX */
763 if (inp->inp_lport == 0 &&
764 (error = in6_pcbsetport(laddr, inp, td->td_ucred)) != 0) {
766 inp->in6p_laddr = in6addr_any;
770 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
774 if (IN6_IS_ADDR_V4MAPPED(&inp->in6p_faddr)) {
775 if ((inp->inp_flags & IN6P_IPV6_V6ONLY)) {
790 laddr = &inp->in6p_laddr;
791 faddr = &inp->in6p_faddr;
792 fport = inp->inp_fport;
812 udp6->uh_sport = inp->inp_lport; /* lport is always set in the PCB */
817 up = intoudpcb(inp);
836 ip6->ip6_flow = inp->inp_flow & IPV6_FLOWINFO_MASK;
841 ip6->ip6_hlim = in6_selecthlim(inp, NULL);
860 pr = inp->inp_socket->so_proto->pr_protocol;
878 inp->inp_lport, pr, &hash_val, &hash_type) == 0) {
887 * Don't override with the inp cached flowid.
895 UDP_PROBE(send, NULL, inp, ip6, inp, udp6);
897 error = ip6_output(m, optp, &inp->inp_route6, flags,
898 inp->in6p_moptions, NULL, inp);
920 struct inpcb *inp;
924 inp = sotoinpcb(so);
925 KASSERT(inp != NULL, ("udp6_abort: inp == NULL"));
927 INP_WLOCK(inp);
929 if (inp->inp_vflag & INP_IPV4) {
933 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
935 INP_WUNLOCK(inp);
942 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
944 in6_pcbdisconnect(inp);
945 inp->in6p_laddr = in6addr_any;
949 INP_WUNLOCK(inp);
955 struct inpcb *inp;
960 inp = sotoinpcb(so);
961 KASSERT(inp == NULL, ("udp6_attach: inp != NULL"));
974 inp = (struct inpcb *)so->so_pcb;
975 inp->inp_vflag |= INP_IPV6;
976 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0)
977 inp->inp_vflag |= INP_IPV4;
978 inp->in6p_hops = -1; /* use kernel default */
979 inp->in6p_cksum = -1; /* just to be sure */
986 inp->inp_ip_ttl = V_ip_defttl;
988 error = udp_newudpcb(inp);
990 in_pcbdetach(inp);
991 in_pcbfree(inp);
995 INP_WUNLOCK(inp);
1003 struct inpcb *inp;
1009 inp = sotoinpcb(so);
1010 KASSERT(inp != NULL, ("udp6_bind: inp == NULL"));
1012 INP_WLOCK(inp);
1014 vflagsav = inp->inp_vflag;
1015 inp->inp_vflag &= ~INP_IPV4;
1016 inp->inp_vflag |= INP_IPV6;
1017 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
1023 inp->inp_vflag |= INP_IPV4;
1029 inp->inp_vflag |= INP_IPV4;
1030 inp->inp_vflag &= ~INP_IPV6;
1031 error = in_pcbbind(inp, (struct sockaddr *)&sin,
1038 error = in6_pcbbind(inp, nam, td->td_ucred);
1043 inp->inp_vflag = vflagsav;
1045 INP_WUNLOCK(inp);
1052 struct inpcb *inp;
1056 inp = sotoinpcb(so);
1057 KASSERT(inp != NULL, ("udp6_close: inp == NULL"));
1059 INP_WLOCK(inp);
1061 if (inp->inp_vflag & INP_IPV4) {
1065 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
1067 INP_WUNLOCK(inp);
1073 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
1075 in6_pcbdisconnect(inp);
1076 inp->in6p_laddr = in6addr_any;
1080 INP_WUNLOCK(inp);
1086 struct inpcb *inp;
1093 inp = sotoinpcb(so);
1095 KASSERT(inp != NULL, ("udp6_connect: inp == NULL"));
1100 INP_WLOCK(inp);
1105 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0) {
1109 if ((inp->inp_vflag & INP_IPV4) == 0) {
1113 if (inp->inp_faddr.s_addr != INADDR_ANY) {
1121 vflagsav = inp->inp_vflag;
1122 inp->inp_vflag |= INP_IPV4;
1123 inp->inp_vflag &= ~INP_IPV6;
1125 error = in_pcbconnect(inp, (struct sockaddr *)&sin,
1135 else if (inp->inp_laddr.s_addr == INADDR_ANY &&
1136 inp->inp_lport == 0)
1137 inp->inp_vflag = vflagsav;
1140 if ((inp->inp_vflag & INP_IPV6) == 0) {
1146 if (!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
1153 vflagsav = inp->inp_vflag;
1154 inp->inp_vflag &= ~INP_IPV4;
1155 inp->inp_vflag |= INP_IPV6;
1157 error = in6_pcbconnect(inp, nam, td->td_ucred);
1166 else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) &&
1167 inp->inp_lport == 0)
1168 inp->inp_vflag = vflagsav;
1170 INP_WUNLOCK(inp);
1177 struct inpcb *inp;
1182 inp = sotoinpcb(so);
1183 KASSERT(inp != NULL, ("udp6_detach: inp == NULL"));
1186 INP_WLOCK(inp);
1187 up = intoudpcb(inp);
1189 in_pcbdetach(inp);
1190 in_pcbfree(inp);
1198 struct inpcb *inp;
1203 inp = sotoinpcb(so);
1204 KASSERT(inp != NULL, ("udp6_disconnect: inp == NULL"));
1206 INP_WLOCK(inp);
1208 if (inp->inp_vflag & INP_IPV4) {
1212 nxt = (inp->inp_socket->so_proto->pr_protocol == IPPROTO_UDP) ?
1214 INP_WUNLOCK(inp);
1221 if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) {
1227 in6_pcbdisconnect(inp);
1228 inp->in6p_laddr = in6addr_any;
1234 INP_WUNLOCK(inp);
1242 struct inpcb *inp;
1247 inp = sotoinpcb(so);
1248 KASSERT(inp != NULL, ("udp6_send: inp == NULL"));
1250 INP_WLOCK(inp);
1263 if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) {
1268 hasv4addr = (inp->inp_vflag & INP_IPV4);
1278 nxt = (inp->inp_socket->so_proto->pr_protocol ==
1283 * this does mean there is a short window where inp's
1288 INP_WUNLOCK(inp);
1299 mac_inpcb_create_mbuf(inp, m);
1302 error = udp6_output(inp, m, addr, control, td);
1304 INP_WUNLOCK(inp);
1308 INP_WUNLOCK(inp);