Lines Matching defs:so

262 in_pcballoc(struct socket *so, struct inpcbinfo *pcbinfo, __unused struct proc *p)
275 if (so->cached_in_sock_layer == 0) {
277 printf("PCBALLOC calling zalloc for socket %x\n", so);
286 printf("PCBALLOC reusing PCB for socket %x\n", so);
288 inp = (struct inpcb *)(void *)so->so_saved_pcb;
296 inp->inp_socket = so;
300 if (so->cached_in_sock_layer == 0)
304 mac_inpcb_label_associate(so, inp);
313 so->so_pcb = (caddr_t)inp;
315 if (so->so_proto->pr_flags & PR_PCBLOCK) {
322 error = ipsec_init_policy(so, &inp->inp_sp);
331 if (INP_SOCKAF(so) == AF_INET6 && !ip6_mapped_addr_on)
371 struct socket *so = inp->inp_socket;
375 if (so->so_usecount == 0) {
427 struct socket *so = inp->inp_socket;
432 int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
440 if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0)
442 socket_unlock(so, 0); /* keep reference on socket */
450 socket_lock(so, 0);
460 socket_lock(so, 0);
473 if (so->so_options & SO_REUSEADDR)
480 socket_lock(so, 0);
501 socket_lock(so, 0);
506 if (kauth_cred_getuid(so->so_cred) &&
515 (kauth_cred_getuid(so->so_cred) !=
523 if ((t->inp_socket->so_flags & SOF_NOTIFYCONFLICT) && ((so->so_flags & SOF_NOTIFYCONFLICT) == 0))
534 socket_lock(so, 0);
547 INP_SOCKAF(so) != AF_INET6 ||
553 if ((t->inp_socket->so_flags & SOF_NOTIFYCONFLICT) && ((so->so_flags & SOF_NOTIFYCONFLICT) == 0))
563 socket_lock(so, 0);
575 randomport = (so->so_flags & SOF_BINDRANDOMPORT) ||
576 (so->so_type == SOCK_STREAM ? tcp_use_randomport : udp_use_randomport);
590 socket_lock(so, 0);
609 * We split the two cases (up and down) so that the direction
625 socket_lock(so, 0);
649 socket_lock(so, 0);
662 socket_lock(so, 0);
672 sflt_notify(so, sock_evt_bound, NULL);
766 /* No route yet, so try to acquire one */
983 struct socket *so = inp->inp_socket;
985 if (so->so_pcb == 0) { /* we've been called twice */
986 panic("in_pcbdetach: inp=%p so=%p proto=%d so_pcb is null!\n",
987 inp, so, so->so_proto->pr_protocol);
998 panic("in_pcbdetach so=%p prot=%x couldn't set to STOPUSING\n", so, so->so_proto->pr_protocol);
1001 if (so->cached_in_sock_layer)
1002 printf("in_pcbdetach for cached socket %x flags=%x\n", so, so->so_flags);
1004 printf("in_pcbdetach for allocated socket %x flags=%x\n", so, so->so_flags);
1006 if ((so->so_flags & SOF_PCBCLEARING) == 0) {
1021 sofreelastref(so, 0);
1023 so->so_flags |= SOF_PCBCLEARING; /* makes sure we're not called twice from so_close */
1031 struct socket *so = inp->inp_socket;
1036 printf("in_pcbdispose: not dead yet? so=%p\n", so);
1039 if (so && so->so_usecount != 0)
1040 panic("%s: so %p so_usecount %d so_lockhistory %s\n",
1041 __func__, so, so->so_usecount,
1042 (so != NULL) ? solockhistory_nr(so) : "--");
1050 if (so) {
1051 if (so->so_proto->pr_flags & PR_PCBLOCK) {
1052 sofreelastref(so, 0);
1053 if (so->so_rcv.sb_cc || so->so_snd.sb_cc) {
1055 printf("in_pcbdispose sb not cleaned up so=%p rc_cci=%x snd_cc=%x\n",
1056 so, so->so_rcv.sb_cc, so->so_snd.sb_cc);
1058 sbrelease(&so->so_rcv);
1059 sbrelease(&so->so_snd);
1061 if (so->so_head != NULL)
1062 panic("in_pcbdispose, so=%p head still exist\n", so);
1066 so->so_flags |= SOF_PCBCLEARING; /* makes sure we're not called twice from so_close */
1067 so->so_saved_pcb = (caddr_t) inp;
1068 so->so_pcb = 0;
1082 if (so->cached_in_sock_layer == 0) {
1085 sodealloc(so);
1096 * in struct pr_usrreqs, so that protocols can just reference then directly
1099 * except through a kernel programming error, so it is acceptable to panic
1108 in_setsockaddr(struct socket *so, struct sockaddr **nam)
1123 inp = sotoinpcb(so);
1136 in_setpeeraddr(struct socket *so, struct sockaddr **nam)
1151 inp = sotoinpcb(so);
1694 * hashed port list would have to be updated as well), so the lport must
1772 panic("in_pcb_checkstate STOP pcb=%p so=%p usecount is negative\n", pcb, pcb->inp_socket);
1828 panic("in_pcb_checkstate RELEASE pcb=%p so=%p usecount is negative\n", pcb, pcb->inp_socket);
1837 panic("in_pcb_checkstate: so=%p not a valid state =%x\n", pcb->inp_socket, mode);
2159 struct socket *so = inp->inp_socket;
2162 VERIFY (so != NULL);
2163 socket_lock(so, 1);
2166 socket_unlock(so, 1);
2176 socket_unlock(so, 1);
2181 if (so->so_proto->pr_type == SOCK_STREAM)
2184 socket_unlock(so, 1);
2190 struct socket *so = inp->inp_socket;
2197 so->so_flags &= ~(SOF_SUSPENDED);
2198 soevent(so, (SO_FILT_HINT_LOCKED | SO_FILT_HINT_RESUME));
2206 sowwakeup(so);
2270 void inp_clear_INP_INADDR_ANY(struct socket *so)
2274 socket_lock(so, 1);
2275 inp = sotoinpcb(so);
2279 socket_unlock(so, 1);